Commit Graph

83 Commits

Author SHA1 Message Date
mark
2c31b45ae8 mv std libs to library/ 2020-07-27 19:51:13 -05:00
bors
d8cf749570 Auto merge of #74507 - lcnr:const-prop-into-op, r=oli-obk
add `visit_operand` to const prop

r? @oli-obk
2020-07-24 20:10:34 +00:00
Xavier Denis
711a6807a7 Optimize away BitAnd and BitOr when possible 2020-07-22 11:32:36 +02:00
Bastian Kauschke
c74c648602 const prop into operands 2020-07-22 10:29:37 +02:00
Bastian Kauschke
a909eb6b65 improve naming 2020-07-15 13:06:47 +02:00
Bastian Kauschke
9df03ccf62 mir opt cross compile 2020-07-15 12:58:32 +02:00
Bastian Kauschke
4ef1029f5c mir opt diff 2020-07-15 12:58:32 +02:00
Oliver Scherer
819cde5dab Show the values and computation that would overflow a const evaluation or propagation 2020-06-26 10:08:52 +02:00
Oliver Scherer
5fa8b08808 The const propagator cannot trace references.
Thus we avoid propagation of a local the moment we encounter references to it.
2020-06-23 10:18:14 +02:00
bors
38bd83df88 Auto merge of #71911 - wesleywiser:const_prop_small_cleanups, r=oli-obk
[mir-opt] Small ConstProp cleanup
2020-06-21 05:56:26 +00:00
Ralf Jung
098949b504
Rollup merge of #73130 - wesleywiser:remove_const_prop_for_indirects, r=oli-obk
Remove const prop for indirects

This was only used by one mir-opt test and since it causes buggy behavior under `-Zmir-opt-level=2`, it seems like we should remove it.

This was split out from #71946.

Closes #72679
Closes #72372
Closes #72285
2020-06-19 08:56:06 +02:00
Wesley Wiser
c06876c904 [const-prop] Remove ConstPropMode::NoPropagation
This mode is unnecessary because it's always ok to evaluate the
right-hand side of assignments even if the left-hand side should not
have reads propagated.
2020-06-15 21:09:47 -04:00
Lzu Tao
c755292859 Prefer the associated consts for pattern matching error 2020-06-13 01:18:18 +00:00
Wesley Wiser
1e88f130a3 Stop allowing Indirect(..) values to be propagated
Closes #72679
Closes #72372
Closes #72285
2020-06-09 08:04:36 -04:00
Felix S. Klock II
34c0f0599d Revert "Bless mir-opt tests"
This reverts commit a030c92341.
2020-06-04 11:29:10 -04:00
Jonas Schievink
2359299537 Clear MIR local type annotations after borrowck 2020-05-24 04:15:23 +02:00
bors
7faeae0d38 Auto merge of #72135 - oli-obk:const_prop_deaggregates, r=wesleywiser
Propagate locals, even if they have unpropagatable assignments somewhere

Second try for https://github.com/rust-lang/rust/pull/71946#discussion_r422967292

r? @wesleywiser

cc @rust-lang/wg-mir-opt @RalfJung
2020-05-17 09:18:12 +00:00
Wesley Wiser
27c818bc56 Bless mir-opt tests to account for #72220 2020-05-16 22:13:50 -04:00
Wesley Wiser
e84b379351 [const-prop] Don't replace Rvalues that are already constants 2020-05-14 19:07:44 -04:00
Ralf Jung
3fccdb3ded Pointer printing: do not print 0 offset 2020-05-12 13:30:50 +02:00
Oliver Scherer
0a785cdf34 Add some more sanity tests and add a debug log message for it 2020-05-12 13:23:01 +02:00
Oliver Scherer
de434d8e44 Propagate locals, even if they have unpropagatable assignments somewhere. 2020-05-12 13:14:47 +02:00
Oliver Scherer
c849a0d087 Add a repro example for not propagating constants of partially const initialized variables 2020-05-12 12:55:55 +02:00
bors
3fe4dd2dda Auto merge of #71953 - oli-obk:const_prop_deaggregates, r=wesleywiser
Const prop aggregates even if partially or fully modified

r? @wesleywiser

cc @rust-lang/wg-mir-opt I'm moderately scared of this change, but I'm confident in having reviewed all the cases.
2020-05-11 07:23:31 +00:00
Matthew Jasper
a030c92341 Bless mir-opt tests 2020-05-09 10:51:39 +01:00
Hanif Bin Ariffin
b2a8b39cd0 Renamed "undef" stuff to "uninit"
1. InvalidUndefBytes -> InvalidUninitBytes
2. ScalarMaybeUndef -> ScalarMaybeUninit
3. UndefMask -> InitMask

Related issue  #71193
2020-05-07 11:27:29 -04:00
Oliver Scherer
a1ebb94775 Const prop aggregates even if partially or fully modified 2020-05-06 19:36:08 +02:00
Félix Fischer
d0dea9f588 Added MIR constant propagation of Scalars into function call arguments
- Documented rationale of current solution
- Polished documentation
2020-05-02 00:40:03 -04:00
Félix Fischer
e2ab2758f2 Added MIR const-prop diff tests to show why some assertions now fail at compile-time 2020-04-28 00:53:44 -04:00
Félix Fischer
86927eddaf Allow Locals to be propagated into and from, but restricted to their own block 2020-04-28 00:44:50 -04:00
Félix Fischer
6316601ec4 Added regression test for literal propagation and for scalar pair propagation 2020-04-27 20:13:16 -04:00
Oliver Scherer
a2fdc94686 Emit basic block ids for statements and terminators in MIR only in -Zverbose mode 2020-04-27 15:16:12 +02:00
David Cook
c16b6e0faa Add leading 0x to offset in Debug fmt of Pointer 2020-04-23 00:43:27 -05:00
Eduard-Mihai Burtescu
eccb28e3d6 ty/print: pretty-print constant aggregates (arrays, tuples and ADTs). 2020-04-17 05:18:32 +03:00
Eduard-Mihai Burtescu
aabed9322e mir: pretty-print Rvalue::Aggregate correctly. 2020-04-17 04:58:37 +03:00
Wesley Wiser
7c0802b341 Remove other Rvalues 2020-04-15 14:53:41 -04:00
Bastian Kauschke
647f810d7b update 32 bit mir-opt tests 2020-04-14 09:14:58 +02:00
Bastian Kauschke
4714e202ae bless mir opt tests 2020-04-13 22:39:10 +02:00
robojumper
b78ff993fd Use write!-style syntax for MIR assert terminator 2020-04-11 13:27:51 +02:00
Ana-Maria Mihalache
ea4aca19c1 Normalize away pairs of line:col numbers. 2020-04-07 17:49:14 +00:00
Ana-Maria Mihalache
e0bb75ef69 Add EMIT_MIR_FOR_EACH_BIT_WIDTH to tests that need it. 2020-04-07 17:49:14 +00:00
Ana-Maria Mihalache
688a4ddd20 --bless more mir-opt tests. 2020-04-07 17:49:14 +00:00
Oliver Scherer
c9a5a03ffd Enable --blessing of MIR dumps 2020-03-26 15:26:33 +01:00
Wesley Wiser
4f405119e8 Resolve worsened debug build codegen 2020-03-21 22:37:51 -04:00
Oliver Scherer
b2e93a41a6 Print leading zeros for non pointers 2020-03-11 09:10:49 +01:00
Oliver Scherer
e22ddfd80d Don't print leading zeros on hex dumps constants 2020-03-11 09:10:49 +01:00
Oliver Scherer
02dbb35b2b Deduplicate and clean up pretty printing logic 2020-03-11 09:10:48 +01:00
Matthew Jasper
30058df867 Update existing tests for or-patterns 2020-02-01 22:10:58 +00:00
Oliver Scherer
9a2d5e87d6 Render const pointers in MIR more compactly 2020-01-24 16:20:58 +01:00
Wesley Wiser
7f65475d00 Turn off const propagation of ref taking
Fixes #67529
Fixes #67640
Fixes #67641
Fixes #67862
2020-01-12 22:27:39 -05:00