Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
4f9c30f
Add initial version of value analysis and dataflow constant propagation
jachris Aug 25, 2022
d0afe68
Try field type normalization instead of forcing it
jachris Aug 29, 2022
601fcc4
Update test results
jachris Aug 29, 2022
56ff16d
Fix spelling
jachris Aug 29, 2022
93ee806
Update test results
jachris Aug 29, 2022
c83489c
Remove empty test
jachris Aug 30, 2022
bb16397
Clarify registration and tracking of references
jachris Aug 30, 2022
2928694
Add additional flooding when assigning a value and corresponding test
jachris Aug 31, 2022
e75ad93
Begin a semi-formal argument for correctness
jachris Aug 31, 2022
1da3033
Change test from usize to i32 to prevent target issues
jachris Aug 31, 2022
3f98dc7
Clarify place expressions vs place objects
jachris Sep 1, 2022
ad99d2e
Move handling of references and simplify flooding
jachris Sep 1, 2022
47a00d5
Flood with bottom instead of top for unreachable branches
jachris Sep 1, 2022
8a789ce
Reject registration of downcasts for now
jachris Sep 1, 2022
469fb19
Update other test results
jachris Sep 1, 2022
16dedba
Ignore terminators explicitly
jachris Sep 1, 2022
fe84bbf
Add tracking of unreachability
jachris Sep 2, 2022
f234419
Rebase onto master
jachris Sep 2, 2022
895181b
Remove leftover test files
jachris Sep 2, 2022
2e4d082
Add more documentation
jachris Sep 2, 2022
2113e45
Remove superfluous line
jachris Sep 2, 2022
904adca
Flood place on drop
jachris Sep 4, 2022
1e5ca57
Use StorageDead and Deinit to flood place
jachris Sep 4, 2022
e2ddf8a
Add comment about downcast projection element
jachris Sep 4, 2022
817c277
Handle StorageLive
jachris Sep 9, 2022
bc82c13
Track Scalar instead of ScalarInt for const prop
jachris Sep 23, 2022
13b7059
Only allow registration of scalars for now
jachris Sep 27, 2022
6868617
Add tests from current const prop
jachris Sep 27, 2022
4cda6e5
Update test results
jachris Sep 27, 2022
97a69a7
Add some more unit-test directives
jachris Sep 27, 2022
c56e99c
Fix typo
jachris Sep 27, 2022
f99950f
Update test results after rebase
jachris Oct 4, 2022
eab7732
Handle NonDivergingIntrinsic and CopyNonOverlapping
jachris Oct 5, 2022
2f66e94
Flood with bottom for Deinit, StorageLive and StorageDead
jachris Oct 5, 2022
b5063ab
Make more assumptions explicit
jachris Oct 5, 2022
1765587
Only track (trivially) freeze types
jachris Oct 5, 2022
7ab1ba9
Remove `Unknown` state in favor of `Value(Top)`
jachris Oct 5, 2022
4478a87
Fix formatting
jachris Oct 5, 2022
111324e
Prevent registration inside references if target is !Freeze
jachris Oct 6, 2022
3c0f3b0
Only assume Stacked Borrows if -Zunsound-mir-opts is given
jachris Oct 6, 2022
7a52e73
Add tests for Stacked Borrows behavior
jachris Oct 6, 2022
b9dbb81
Improve example used for SB tests
jachris Oct 6, 2022
5696d06
Use the same is_enabled as the current const prop
jachris Oct 6, 2022
aaa35b3
Add comment for the current retag situation
jachris Oct 12, 2022
890fae9
Fix rebased CastKind
jachris Oct 12, 2022
8bed0b5
Update issue-50814.rs test result
jachris Oct 15, 2022
1dde908
Update test results
jachris Oct 15, 2022
be9013f
Make overflow flag propagation conditional
jachris Oct 15, 2022
931d99f
Make overflow handling more precise
jachris Oct 15, 2022
274a491
Improve documentation, plus some small changes
jachris Oct 19, 2022
062053b
Fix unimplemented binary_ptr_op
jachris Oct 19, 2022
5b7b309
Improve documentation of assumptions
jachris Oct 21, 2022
d86acdd
Prevent propagation of overflow if overflow occured
jachris Oct 23, 2022
de69d08
Explicitly match all terminators
jachris Oct 23, 2022
efc7ca8
Use ParamEnv consistently
jachris Oct 23, 2022
f29533b
Small documentation changes
jachris Oct 24, 2022
1f82a9f
Move HasTop and HasBottom into lattice.rs
jachris Oct 24, 2022
da4a40f
Remove copy of current const prop tests and add a few new tests
jachris Oct 25, 2022
630e17d
Limit number of tracked places, and some other perf improvements
jachris Oct 25, 2022
b478fcf
Use new cast methods
jachris Oct 26, 2022
72196ee
Limit number of basic blocks and tracked places to 100 for now
jachris Oct 27, 2022
89f9349
Small corrections of documentation
jachris Nov 7, 2022
3997893
Fix rebase
jachris Nov 7, 2022
bfbca6c
Completely remove tracking of references for now
jachris Nov 9, 2022
9766ee0
Fix struct field tracking and add tests for it
jachris Nov 9, 2022
8ecb276
Simplify creation of map
jachris Nov 10, 2022
3c6d1a7
Add test for repr(transparent) with scalar
jachris Nov 11, 2022
b3f6489
Add comment for guessed constants
jachris Nov 12, 2022
2e034dc
Exclude locals completely, instead of individual places
jachris Nov 12, 2022
74d53ab
Require -Zmir-opt-level >= 3 for now
jachris Nov 12, 2022
abe31a9
Partially revert 74d53ab
jachris Nov 12, 2022
d66a00a
Expand upon comment regarding self-assignment
jachris Nov 12, 2022
ea23585
Disable limits if mir-opt-level >= 4
jachris Nov 12, 2022
108790b
Remove log statement that was commented out
jachris Nov 12, 2022
c27ddc9
Remove redundant graphviz escaping
jachris Nov 14, 2022
24d2e90
Bless graphviz tests
jachris Nov 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update test results
  • Loading branch information
jachris committed Nov 7, 2022
commit 4cda6e5401980f749db0b847e1521ad1e1e78bea
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@
_2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32]; // scope 0 at $DIR/array_index.rs:+1:18: +1:30
StorageLive(_3); // scope 0 at $DIR/array_index.rs:+1:31: +1:32
_3 = const 2_usize; // scope 0 at $DIR/array_index.rs:+1:31: +1:32
- _4 = Len(_2); // scope 0 at $DIR/array_index.rs:+1:18: +1:33
_4 = Len(_2); // scope 0 at $DIR/array_index.rs:+1:18: +1:33
- _5 = Lt(_3, _4); // scope 0 at $DIR/array_index.rs:+1:18: +1:33
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
+ _4 = const 4_usize; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
+ _5 = const true; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
+ _5 = Lt(const 2_usize, _4); // scope 0 at $DIR/array_index.rs:+1:18: +1:33
+ assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, const 2_usize) -> bb1; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
}

bb1: {
- _1 = _2[_3]; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
+ _1 = const 2_u32; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
_1 = _2[_3]; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
StorageDead(_3); // scope 0 at $DIR/array_index.rs:+1:33: +1:34
StorageDead(_2); // scope 0 at $DIR/array_index.rs:+1:33: +1:34
_0 = const (); // scope 0 at $DIR/array_index.rs:+0:11: +2:2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@
_2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32]; // scope 0 at $DIR/array_index.rs:+1:18: +1:30
StorageLive(_3); // scope 0 at $DIR/array_index.rs:+1:31: +1:32
_3 = const 2_usize; // scope 0 at $DIR/array_index.rs:+1:31: +1:32
- _4 = Len(_2); // scope 0 at $DIR/array_index.rs:+1:18: +1:33
_4 = Len(_2); // scope 0 at $DIR/array_index.rs:+1:18: +1:33
- _5 = Lt(_3, _4); // scope 0 at $DIR/array_index.rs:+1:18: +1:33
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
+ _4 = const 4_usize; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
+ _5 = const true; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
+ _5 = Lt(const 2_usize, _4); // scope 0 at $DIR/array_index.rs:+1:18: +1:33
+ assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, const 2_usize) -> bb1; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
}

bb1: {
- _1 = _2[_3]; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
+ _1 = const 2_u32; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
_1 = _2[_3]; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
StorageDead(_3); // scope 0 at $DIR/array_index.rs:+1:33: +1:34
StorageDead(_2); // scope 0 at $DIR/array_index.rs:+1:33: +1:34
_0 = const (); // scope 0 at $DIR/array_index.rs:+0:11: +2:2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
StorageLive(_3); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19
- _3 = _1; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19
- _4 = Eq(_3, const 0_i32); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
- assert(!move _4, "attempt to divide `{}` by zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
+ _3 = const 0_i32; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19
+ _4 = const true; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
assert(!move _4, "attempt to divide `{}` by zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
+ assert(!const true, "attempt to divide `{}` by zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
}

bb1: {
Expand All @@ -37,11 +38,12 @@
+ _5 = const false; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
+ _6 = const false; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
+ _7 = const false; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
+ assert(!const false, "attempt to compute `{} / {}`, which would overflow", const 1_i32, _3) -> bb2; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
+ assert(!const false, "attempt to compute `{} / {}`, which would overflow", const 1_i32, const 0_i32) -> bb2; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
}

bb2: {
_2 = Div(const 1_i32, move _3); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
- _2 = Div(const 1_i32, move _3); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
+ _2 = Div(const 1_i32, const 0_i32); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
StorageDead(_3); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19
_0 = const (); // scope 0 at $DIR/bad_op_div_by_zero.rs:+0:11: +3:2
StorageDead(_2); // scope 1 at $DIR/bad_op_div_by_zero.rs:+3:1: +3:2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,20 @@
_1 = const 0_i32; // scope 0 at $DIR/bad_op_mod_by_zero.rs:+1:13: +1:14
StorageLive(_2); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:9: +2:11
StorageLive(_3); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19
- _3 = _1; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19
- _4 = Eq(_3, const 0_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
- assert(!move _4, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
+ _3 = const 0_i32; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19
+ _4 = const true; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
+ assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
_3 = const 0_i32; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19
_4 = const true; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
}

bb1: {
- _5 = Eq(_3, const -1_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
- _6 = Eq(const 1_i32, const i32::MIN); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
- _7 = BitAnd(move _5, move _6); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
- assert(!move _7, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> bb2; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
+ _5 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
+ _6 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
+ _7 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
+ assert(!const false, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, const 0_i32) -> bb2; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
_5 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
_6 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
_7 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
assert(!const false, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, const 0_i32) -> bb2; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
}

bb2: {
- _2 = Rem(const 1_i32, move _3); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
+ _2 = Rem(const 1_i32, const 0_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
_2 = Rem(const 1_i32, const 0_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
StorageDead(_3); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19
nop; // scope 0 at $DIR/bad_op_mod_by_zero.rs:+0:11: +3:2
StorageDead(_2); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+3:1: +3:2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@
StorageLive(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
_6 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
_7 = Len((*_1)); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
- _8 = Lt(_6, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
+ _8 = Lt(const 3_usize, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
_8 = Lt(const 3_usize, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
}

bb1: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@
StorageLive(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
_6 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
_7 = Len((*_1)); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
- _8 = Lt(_6, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
+ _8 = Lt(const 3_usize, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
_8 = Lt(const 3_usize, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
}

bb1: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,14 @@
StorageLive(_3); // scope 0 at $DIR/boolean_identities.rs:+1:5: +1:15
StorageLive(_4); // scope 0 at $DIR/boolean_identities.rs:+1:6: +1:7
_4 = _2; // scope 0 at $DIR/boolean_identities.rs:+1:6: +1:7
- _3 = BitOr(move _4, const true); // scope 0 at $DIR/boolean_identities.rs:+1:5: +1:15
+ _3 = const true; // scope 0 at $DIR/boolean_identities.rs:+1:5: +1:15
_3 = const true; // scope 0 at $DIR/boolean_identities.rs:+1:5: +1:15
StorageDead(_4); // scope 0 at $DIR/boolean_identities.rs:+1:14: +1:15
StorageLive(_5); // scope 0 at $DIR/boolean_identities.rs:+1:18: +1:29
StorageLive(_6); // scope 0 at $DIR/boolean_identities.rs:+1:19: +1:20
_6 = _1; // scope 0 at $DIR/boolean_identities.rs:+1:19: +1:20
- _5 = BitAnd(move _6, const false); // scope 0 at $DIR/boolean_identities.rs:+1:18: +1:29
+ _5 = const false; // scope 0 at $DIR/boolean_identities.rs:+1:18: +1:29
_5 = const false; // scope 0 at $DIR/boolean_identities.rs:+1:18: +1:29
StorageDead(_6); // scope 0 at $DIR/boolean_identities.rs:+1:28: +1:29
- _0 = BitAnd(move _3, move _5); // scope 0 at $DIR/boolean_identities.rs:+1:5: +1:29
+ _0 = const false; // scope 0 at $DIR/boolean_identities.rs:+1:5: +1:29
_0 = const false; // scope 0 at $DIR/boolean_identities.rs:+1:5: +1:29
StorageDead(_5); // scope 0 at $DIR/boolean_identities.rs:+1:28: +1:29
StorageDead(_3); // scope 0 at $DIR/boolean_identities.rs:+1:28: +1:29
return; // scope 0 at $DIR/boolean_identities.rs:+2:2: +2:2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@
StorageLive(_1); // scope 0 at $DIR/boxes.rs:+1:9: +1:10
StorageLive(_2); // scope 0 at $DIR/boxes.rs:+1:13: +1:22
StorageLive(_3); // scope 0 at $DIR/boxes.rs:+1:14: +1:22
- _4 = SizeOf(i32); // scope 2 at $DIR/boxes.rs:+1:14: +1:22
- _5 = AlignOf(i32); // scope 2 at $DIR/boxes.rs:+1:14: +1:22
+ _4 = const 4_usize; // scope 2 at $DIR/boxes.rs:+1:14: +1:22
+ _5 = const 4_usize; // scope 2 at $DIR/boxes.rs:+1:14: +1:22
_4 = SizeOf(i32); // scope 2 at $DIR/boxes.rs:+1:14: +1:22
_5 = AlignOf(i32); // scope 2 at $DIR/boxes.rs:+1:14: +1:22
_6 = alloc::alloc::exchange_malloc(move _4, move _5) -> bb1; // scope 2 at $DIR/boxes.rs:+1:14: +1:22
// mir::Constant
// + span: $DIR/boxes.rs:13:14: 13:22
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@

bb0: {
StorageLive(_1); // scope 0 at $DIR/checked_add.rs:+1:9: +1:10
- _2 = CheckedAdd(const 1_u32, const 1_u32); // scope 0 at $DIR/checked_add.rs:+1:18: +1:23
_2 = CheckedAdd(const 1_u32, const 1_u32); // scope 0 at $DIR/checked_add.rs:+1:18: +1:23
- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 1_u32, const 1_u32) -> bb1; // scope 0 at $DIR/checked_add.rs:+1:18: +1:23
+ _2 = const (2_u32, false); // scope 0 at $DIR/checked_add.rs:+1:18: +1:23
+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 1_u32, const 1_u32) -> bb1; // scope 0 at $DIR/checked_add.rs:+1:18: +1:23
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
+ // MIR for `hello` after DataflowConstProp

fn hello() -> () {
let mut _0: (); // return place in scope 0 at $DIR/control-flow-simplification.rs:+0:14: +0:14
let mut _0: (); // return place in scope 0 at $DIR/control-flow-simplification.rs:+0:15: +0:15
let mut _1: bool; // in scope 0 at $DIR/control-flow-simplification.rs:+1:8: +1:21
let mut _2: !; // in scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL

bb0: {
StorageLive(_1); // scope 0 at $DIR/control-flow-simplification.rs:+1:8: +1:21
- _1 = const <bool as NeedsDrop>::NEEDS; // scope 0 at $DIR/control-flow-simplification.rs:+1:8: +1:21
- switchInt(move _1) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/control-flow-simplification.rs:+1:8: +1:21
+ _1 = const false; // scope 0 at $DIR/control-flow-simplification.rs:+1:8: +1:21
+ switchInt(const false) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/control-flow-simplification.rs:+1:8: +1:21
_1 = const false; // scope 0 at $DIR/control-flow-simplification.rs:+1:8: +1:21
switchInt(const false) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/control-flow-simplification.rs:+1:8: +1:21
}

bb1: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// MIR for `hello` before PreCodegen

fn hello() -> () {
let mut _0: (); // return place in scope 0 at $DIR/control-flow-simplification.rs:+0:14: +0:14
let mut _0: (); // return place in scope 0 at $DIR/control-flow-simplification.rs:+0:15: +0:15

bb0: {
return; // scope 0 at $DIR/control-flow-simplification.rs:+4:2: +4:2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@
Deinit(_3); // scope 2 at $DIR/discriminant.rs:+1:34: +1:44
((_3 as Some).0: bool) = const true; // scope 2 at $DIR/discriminant.rs:+1:34: +1:44
discriminant(_3) = 1; // scope 2 at $DIR/discriminant.rs:+1:34: +1:44
- _4 = discriminant(_3); // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
+ _4 = const 1_isize; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
+ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
_4 = discriminant(_3); // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
}

bb1: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@
Deinit(_3); // scope 2 at $DIR/discriminant.rs:+1:34: +1:44
((_3 as Some).0: bool) = const true; // scope 2 at $DIR/discriminant.rs:+1:34: +1:44
discriminant(_3) = 1; // scope 2 at $DIR/discriminant.rs:+1:34: +1:44
- _4 = discriminant(_3); // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
+ _4 = const 1_isize; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
+ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
_4 = discriminant(_3); // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
}

bb1: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
- _3 = CheckedAdd(_2, const 1_u8); // scope 0 at $DIR/indirect.rs:+1:13: +1:29
- assert(!move (_3.1: bool), "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> bb1; // scope 0 at $DIR/indirect.rs:+1:13: +1:29
+ _2 = const 2_u8; // scope 0 at $DIR/indirect.rs:+1:13: +1:25
+ _3 = const (3_u8, false); // scope 0 at $DIR/indirect.rs:+1:13: +1:29
+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> bb1; // scope 0 at $DIR/indirect.rs:+1:13: +1:29
+ _3 = CheckedAdd(const 2_u8, const 1_u8); // scope 0 at $DIR/indirect.rs:+1:13: +1:29
+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u8, const 1_u8) -> bb1; // scope 0 at $DIR/indirect.rs:+1:13: +1:29
}

bb1: {
Expand Down
Loading