Commit Graph

119 Commits

Author SHA1 Message Date
joboet
989660c3e6
rename expose_addr to expose_provenance 2024-04-03 16:00:38 +02:00
Matthew Jasper
a277c901d9 Remove MIR unsafe check
This also remove safety information from MIR.
2024-04-03 08:50:12 +00:00
Ralf Jung
038e7c6c38 rename MIR int2ptr casts to match library name 2024-03-23 13:18:33 +01:00
Ralf Jung
7d99e80c55 MIR printing: print the path of uneval'd const; refer to promoteds in a consistent way 2024-03-10 14:59:41 +01:00
许杰友 Jieyou Xu (Joe)
6e48b96692
[AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
Camille GILLOT
304b4ad8b9 Compute unsizing casts in GVN. 2024-02-09 21:01:57 +00:00
George Bateman
803b810eac
Remove feature(offset_of) from tests 2024-01-19 20:38:51 +00:00
Camille GILLOT
3c48243b6f Simplify Len. 2024-01-16 22:20:54 +00:00
Camille GILLOT
666030c51b Simplify binary ops. 2024-01-16 22:20:53 +00:00
Camille GILLOT
7e39100586 Avoid recording no-op replacements. 2024-01-07 13:54:05 +00:00
Camille GILLOT
4ee01faaf0 Do not re-simplify SSA locals. 2024-01-07 13:54:05 +00:00
Camille GILLOT
2837727471 Replace legacy ConstProp by GVN. 2023-12-24 20:08:57 +00:00
Camille GILLOT
30a95b7c0a FileCheck while_let_loops. 2023-12-02 21:10:04 +00:00
Camille GILLOT
c00068e49f FileCheck tuple_literal_propagation. 2023-12-02 21:08:55 +00:00
Camille GILLOT
87522d0007 FileCheck return_place. 2023-12-02 21:08:12 +00:00
Camille GILLOT
a12027e128 FileCheck switch_int. 2023-12-02 21:06:48 +00:00
Camille GILLOT
19767eb7a6 FileCheck slice_len. 2023-12-02 21:06:38 +00:00
Camille GILLOT
3e90c1b434 FileCheck scalar_literal_propagation. 2023-12-02 21:02:42 +00:00
Camille GILLOT
f3743aec51 FileCheck repeat. 2023-12-02 21:01:48 +00:00
Camille GILLOT
343ef6a9cb FileCheck reify_fn_ptr. 2023-12-02 21:00:59 +00:00
Camille GILLOT
6baec3ccc2 FileCheck ref_deref. 2023-12-02 20:58:45 +00:00
Camille GILLOT
c8c9207e4c FileCheck read_immutable_static. 2023-12-02 20:56:26 +00:00
Camille GILLOT
45dd5d6bf3 FileCheck mutable_variable_unprop_assign. 2023-12-02 20:54:56 +00:00
Camille GILLOT
6a8eea8f5b FileCheck mutable_variable_aggregate_partial_read. 2023-12-02 20:51:23 +00:00
Camille GILLOT
d91bb5074e FileCheck mutable_variable_no_prop. 2023-12-02 20:50:00 +00:00
Camille GILLOT
3e169abc1b FileCheck mutable_variable_aggregate_mut_ref. 2023-12-02 20:49:50 +00:00
Camille GILLOT
03c5ad1549 FileCheck mutable_variable_aggregate. 2023-12-02 20:49:38 +00:00
Camille GILLOT
ea9f968333 FileCheck mutable_variable. 2023-12-02 20:49:28 +00:00
Camille GILLOT
902a3e2e75 FileCheck mult_by_zero. 2023-12-02 20:39:26 +00:00
Camille GILLOT
8e9b912c4c FileCheck issue_67019. 2023-12-02 20:38:07 +00:00
Camille GILLOT
ce9b1e23a5 FileCheck issue_66971. 2023-12-02 20:37:05 +00:00
Camille GILLOT
218d8ccf43 FileCheck inherit_overflow. 2023-12-02 20:31:27 +00:00
Camille GILLOT
6086dd6766 FileCheck indirect. 2023-12-02 20:29:47 +00:00
Camille GILLOT
bf5d114da8 FileCheck discriminant. 2023-12-02 20:28:33 +00:00
Camille GILLOT
043d29b58a FileCheck and rename const_prop_fails_gracefully. 2023-12-02 20:23:16 +00:00
Camille GILLOT
7f328d2a44 FileCheck checked_add. 2023-12-02 20:18:58 +00:00
Camille GILLOT
e6a1b77cd1 FileCheck cast. 2023-12-02 20:18:47 +00:00
Camille GILLOT
b8f2f63931 FileCheck boxes. 2023-12-02 20:18:21 +00:00
Camille GILLOT
3fc03948a8 FileCheck boolean_identities. 2023-12-02 20:18:14 +00:00
Camille GILLOT
e8e35c8127 FileCheck bad_op_unsafe_oob_for_slices. 2023-12-02 20:18:02 +00:00
Camille GILLOT
97f03cb898 FileCheck bad_op_mod_by_zero. 2023-12-02 20:17:49 +00:00
Camille GILLOT
0d5bc872a9 FileCheck bad_op_div_by_zero. 2023-12-02 20:17:37 +00:00
Camille GILLOT
9f01d9d1b6 FileCheck array_index. 2023-12-02 20:17:20 +00:00
Camille GILLOT
6564bac532 FileCheck aggregate. 2023-12-02 20:17:04 +00:00
Camille GILLOT
378abbc604 FileCheck address_of_pair. 2023-12-02 20:16:49 +00:00
Matthias Krüger
434232f7b2
Rollup merge of #118426 - aDotInTheVoid:const-wat, r=compiler-errors,cjgillot
ConstProp: Correctly remove const if unknown value assigned to it.

Closes #118328

The problematic sequence of MIR is:

```rust
          _1 = const 0_usize;
          _1 = const _; // This is an associated constant we can't know before monomorphization.
          _0 = _1;
```

1. When `ConstProp::visit_assign` happens on `_1 = const 0_usize;`, it records that `0x0usize` is the value for `_1`.
2. Next `visit_assign` happens on `_1 = const _;`. Because the rvalue `.has_param()`, it can't be const evaled.
3. Finaly, `visit_assign` happens on `_0 = _1;`. Here it would think the value of `_1` was `0x0usize` from step 1.

The solution is to remove consts when checking the RValue fails, as they may have contained values that should now be invalidated, as that local was overwritten.

This should probably be back-ported to beta. Stable is more iffy, as it's gone unidentified since 1.70, so I only think it's worthwhile if there's another reason for a 1.74.1 release anyway.
2023-11-29 12:34:50 +01:00
Alona Enraght-Moony
6e956c0a38 Rename and add another test 2023-11-28 23:17:28 +00:00
Alona Enraght-Moony
9121a41450 ConstProp: Remove const when rvalue check fails. 2023-11-28 22:15:11 +00:00
Alona Enraght-Moony
b1a6cf4a0e Precommit test for https://github.com/rust-lang/rust/issues/118328. 2023-11-28 15:12:46 +00:00
bohan
fc87d6e23d add track_caller for arith ops 2023-11-24 00:54:06 +08:00