Files
rust/tests/ui
bors 8d76d07666 Auto merge of #116012 - cjgillot:gvn-const, r=oli-obk
Implement constant propagation on top of MIR SSA analysis

This implements the idea I proposed in https://github.com/rust-lang/rust/pull/110719#issuecomment-1718324700

Based on https://github.com/rust-lang/rust/pull/109597

The value numbering "GVN" pass formulates each rvalue that appears in MIR with an abstract form (the `Value` enum), and assigns an integer `VnIndex` to each. This abstract form can be used to deduplicate values, reusing an earlier local that holds the same value instead of recomputing. This part is proposed in #109597.

From this abstract representation, we can perform more involved simplifications, for example in https://github.com/rust-lang/rust/pull/111344.

With the abstract representation `Value`, we can also attempt to evaluate each to a constant using the interpreter. This builds a `VnIndex -> OpTy` map. From this map, we can opportunistically replace an operand or a rvalue with a constant if their value has an associated `OpTy`.

The most relevant commit is [Evaluated computed values to constants.](https://github.com/rust-lang/rust/commit/2767c4912ea249c2f613a9cedcd6c13ea1237e54)"

r? `@oli-obk`
2023-12-30 03:45:58 +00:00
..
2023-12-22 11:01:07 -08:00
2023-12-14 15:22:37 +01:00
2023-12-10 10:56:22 +08:00
2023-12-20 22:53:56 -05:00
2023-12-14 15:22:37 +01:00
2023-11-28 23:17:28 +00:00
2023-12-24 01:58:13 +08:00
2023-12-07 17:46:36 +01:00
2023-12-19 13:35:37 -05:00
2023-09-06 12:09:29 +03:00
2023-12-23 00:09:37 +08:00
2023-12-10 14:25:57 +01:00
2023-12-19 13:35:37 -05:00
2023-12-14 15:22:37 +01:00
2023-12-10 10:56:22 +08:00
2023-12-01 20:01:39 +00:00
2023-12-14 15:22:37 +01:00
2023-12-15 16:12:27 +00:00
2023-12-17 07:31:07 +00:00
2023-11-24 21:04:51 +01:00
2023-12-27 15:47:57 +08:00
2023-12-10 10:56:22 +08:00
2023-12-14 15:22:37 +01:00
2023-12-19 13:35:37 -05:00
2023-12-14 15:22:37 +01:00
2023-12-10 10:56:22 +08:00
2023-12-15 16:12:27 +00:00
2023-12-14 15:22:37 +01:00
2023-07-29 11:47:26 +02:00
2023-10-28 23:11:03 -07:00
2023-08-14 16:57:51 -07:00
2023-12-22 11:01:07 -08:00
2023-12-19 13:35:37 -05:00
2023-10-20 21:14:01 +00:00
2023-12-22 11:01:07 -08:00
2023-12-10 10:56:22 +08:00
2023-12-10 10:56:22 +08:00
2023-12-14 15:22:37 +01:00
2023-12-19 13:35:37 -05:00
2023-12-10 10:56:22 +08:00
2023-09-10 23:06:14 +02:00
2023-09-10 23:06:14 +02:00
2023-10-20 21:14:01 +00:00