Simplify Len.

This commit is contained in:
Camille GILLOT 2023-03-20 20:15:59 +00:00
parent 5fc23ad8e6
commit 3c48243b6f
15 changed files with 96 additions and 52 deletions

View file

@ -18,11 +18,12 @@
_2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32];
StorageLive(_3);
_3 = const 2_usize;
_4 = Len(_2);
- _4 = Len(_2);
- _5 = Lt(_3, _4);
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable];
+ _5 = Lt(const 2_usize, _4);
+ assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, const 2_usize) -> [success: bb1, unwind unreachable];
+ _4 = const 4_usize;
+ _5 = const true;
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind unreachable];
}
bb1: {

View file

@ -18,11 +18,12 @@
_2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32];
StorageLive(_3);
_3 = const 2_usize;
_4 = Len(_2);
- _4 = Len(_2);
- _5 = Lt(_3, _4);
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue];
+ _5 = Lt(const 2_usize, _4);
+ assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, const 2_usize) -> [success: bb1, unwind continue];
+ _4 = const 4_usize;
+ _5 = const true;
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind continue];
}
bb1: {

View file

@ -18,11 +18,12 @@
_2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32];
StorageLive(_3);
_3 = const 2_usize;
_4 = Len(_2);
- _4 = Len(_2);
- _5 = Lt(_3, _4);
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable];
+ _5 = Lt(const 2_usize, _4);
+ assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, const 2_usize) -> [success: bb1, unwind unreachable];
+ _4 = const 4_usize;
+ _5 = const true;
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind unreachable];
}
bb1: {

View file

@ -18,11 +18,12 @@
_2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32];
StorageLive(_3);
_3 = const 2_usize;
_4 = Len(_2);
- _4 = Len(_2);
- _5 = Lt(_3, _4);
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue];
+ _5 = Lt(const 2_usize, _4);
+ assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, const 2_usize) -> [success: bb1, unwind continue];
+ _4 = const 4_usize;
+ _5 = const true;
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind continue];
}
bb1: {

View file

@ -18,11 +18,12 @@
_2 = [const 0_u8; 5000];
StorageLive(_3);
_3 = const 2_usize;
_4 = Len(_2);
- _4 = Len(_2);
- _5 = Lt(_3, _4);
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable];
+ _5 = Lt(const 2_usize, _4);
+ assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, const 2_usize) -> [success: bb1, unwind unreachable];
+ _4 = const 5000_usize;
+ _5 = const true;
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind unreachable];
}
bb1: {

View file

@ -18,11 +18,12 @@
_2 = [const 0_u8; 5000];
StorageLive(_3);
_3 = const 2_usize;
_4 = Len(_2);
- _4 = Len(_2);
- _5 = Lt(_3, _4);
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue];
+ _5 = Lt(const 2_usize, _4);
+ assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, const 2_usize) -> [success: bb1, unwind continue];
+ _4 = const 5000_usize;
+ _5 = const true;
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind continue];
}
bb1: {

View file

@ -18,11 +18,12 @@
_2 = [const 0_u8; 5000];
StorageLive(_3);
_3 = const 2_usize;
_4 = Len(_2);
- _4 = Len(_2);
- _5 = Lt(_3, _4);
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable];
+ _5 = Lt(const 2_usize, _4);
+ assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, const 2_usize) -> [success: bb1, unwind unreachable];
+ _4 = const 5000_usize;
+ _5 = const true;
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind unreachable];
}
bb1: {

View file

@ -18,11 +18,12 @@
_2 = [const 0_u8; 5000];
StorageLive(_3);
_3 = const 2_usize;
_4 = Len(_2);
- _4 = Len(_2);
- _5 = Lt(_3, _4);
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue];
+ _5 = Lt(const 2_usize, _4);
+ assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, const 2_usize) -> [success: bb1, unwind continue];
+ _4 = const 5000_usize;
+ _5 = const true;
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind continue];
}
bb1: {

View file

@ -20,11 +20,12 @@
_3 = [const 42_u32; 8];
StorageLive(_4);
_4 = const 2_usize;
_5 = Len(_3);
- _5 = Len(_3);
- _6 = Lt(_4, _5);
- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind unreachable];
+ _6 = Lt(const 2_usize, _5);
+ assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, const 2_usize) -> [success: bb1, unwind unreachable];
+ _5 = const 8_usize;
+ _6 = const true;
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind unreachable];
}
bb1: {

View file

@ -20,11 +20,12 @@
_3 = [const 42_u32; 8];
StorageLive(_4);
_4 = const 2_usize;
_5 = Len(_3);
- _5 = Len(_3);
- _6 = Lt(_4, _5);
- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind continue];
+ _6 = Lt(const 2_usize, _5);
+ assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, const 2_usize) -> [success: bb1, unwind continue];
+ _5 = const 8_usize;
+ _6 = const true;
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind continue];
}
bb1: {

View file

@ -20,11 +20,12 @@
_3 = [const 42_u32; 8];
StorageLive(_4);
_4 = const 2_usize;
_5 = Len(_3);
- _5 = Len(_3);
- _6 = Lt(_4, _5);
- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind unreachable];
+ _6 = Lt(const 2_usize, _5);
+ assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, const 2_usize) -> [success: bb1, unwind unreachable];
+ _5 = const 8_usize;
+ _6 = const true;
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind unreachable];
}
bb1: {

View file

@ -20,11 +20,12 @@
_3 = [const 42_u32; 8];
StorageLive(_4);
_4 = const 2_usize;
_5 = Len(_3);
- _5 = Len(_3);
- _6 = Lt(_4, _5);
- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind continue];
+ _6 = Lt(const 2_usize, _5);
+ assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, const 2_usize) -> [success: bb1, unwind continue];
+ _5 = const 8_usize;
+ _6 = const true;
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind continue];
}
bb1: {

View file

@ -32,11 +32,12 @@
StorageLive(_6);
StorageLive(_7);
_7 = const 0_usize;
_8 = Len(_3);
- _8 = Len(_3);
- _9 = Lt(_7, _8);
- assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb1, unwind unreachable];
+ _9 = Lt(const 0_usize, _8);
+ assert(move _9, "index out of bounds: the length is {} but the index is {}", _8, const 0_usize) -> [success: bb1, unwind unreachable];
+ _8 = const N;
+ _9 = Lt(const 0_usize, const N);
+ assert(move _9, "index out of bounds: the length is {} but the index is {}", const N, const 0_usize) -> [success: bb1, unwind unreachable];
}
bb1: {
@ -57,9 +58,9 @@
- _13 = Len(_3);
- _14 = Lt(_12, _13);
- assert(move _14, "index out of bounds: the length is {} but the index is {}", move _13, _12) -> [success: bb3, unwind unreachable];
+ _13 = _8;
+ _14 = Lt(_2, _8);
+ assert(move _14, "index out of bounds: the length is {} but the index is {}", _8, _2) -> [success: bb3, unwind unreachable];
+ _13 = const N;
+ _14 = Lt(_2, const N);
+ assert(move _14, "index out of bounds: the length is {} but the index is {}", const N, _2) -> [success: bb3, unwind unreachable];
}
bb3: {

View file

@ -32,11 +32,12 @@
StorageLive(_6);
StorageLive(_7);
_7 = const 0_usize;
_8 = Len(_3);
- _8 = Len(_3);
- _9 = Lt(_7, _8);
- assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb1, unwind continue];
+ _9 = Lt(const 0_usize, _8);
+ assert(move _9, "index out of bounds: the length is {} but the index is {}", _8, const 0_usize) -> [success: bb1, unwind continue];
+ _8 = const N;
+ _9 = Lt(const 0_usize, const N);
+ assert(move _9, "index out of bounds: the length is {} but the index is {}", const N, const 0_usize) -> [success: bb1, unwind continue];
}
bb1: {
@ -57,9 +58,9 @@
- _13 = Len(_3);
- _14 = Lt(_12, _13);
- assert(move _14, "index out of bounds: the length is {} but the index is {}", move _13, _12) -> [success: bb3, unwind continue];
+ _13 = _8;
+ _14 = Lt(_2, _8);
+ assert(move _14, "index out of bounds: the length is {} but the index is {}", _8, _2) -> [success: bb3, unwind continue];
+ _13 = const N;
+ _14 = Lt(_2, const N);
+ assert(move _14, "index out of bounds: the length is {} but the index is {}", const N, _2) -> [success: bb3, unwind continue];
}
bb3: {