Commit Graph

25 Commits

Author SHA1 Message Date
Scott McMurray c18718c9c2 Less unsafe in dangling/without_provenance 2025-01-15 22:17:57 -08:00
Scott McMurray 293f8e8941 Refactor the cast-then-cast cases together, and support transmute-then-transmute 2025-01-08 18:46:30 -08:00
Scott McMurray 8dcc676c92 [mir-opt] GVN some more transmute cases
We already did `Transmute`-then-`PtrToPtr`; this adds the nearly-identical `PtrToPtr`-then-`Transmute`.

It also adds `transmute(Foo(x))` → `transmute(x)`, when `Foo` is a single-field transparent type.  That's useful for things like `NonNull { pointer: p }.as_ptr()`.

Found these as I was looking at MCP807-related changes.
2025-01-08 18:46:30 -08:00
Scott McMurray 7afce4f06a Update NonZero and NonNull to not field-project (per MCP807) 2024-12-03 11:13:34 -08:00
Gabriel Bjørnager Jensen 94ab726c78 Add 'from_ref' and 'from_mut' constructors to 'core::ptr::NonNull'; 2024-09-27 13:39:08 +02:00
Scott McMurray 99cb0c6bc3 Bless *all* the mir-opt tests 2024-08-18 16:07:33 -07:00
DianQK ae681c940d Perform instsimplify before inline to eliminate some trivial calls 2024-07-29 18:14:35 +08:00
Scott McMurray b611b6bbb8 Replace NormalizeArrayLen with GVN
GVN is actually on in release, and covers all the same things (or more), with `LowerSliceLen` changed to produce `PtrMetadata`.
2024-06-20 22:16:59 -07:00
Scott McMurray 4630d1b23b Ban ArrayToPointer and MutToConstPointer from runtime MIR
Apparently MIR borrowck cares about at least one of these for checking variance.

In runtime MIR, though, there's no need for them as `PtrToPtr` does the same thing.

(Banning them simplifies passes like GVN that no longer need to handle multiple cast possibilities.)
2024-06-19 10:44:01 -07:00
Scott McMurray a4d0fc39ba Add SingleUseConsts mir-opt pass 2024-06-10 00:06:02 -07:00
Camille GILLOT e110567dcd Revert "Auto merge of #115105 - cjgillot:dest-prop-default, r=oli-obk"
This reverts commit cfb730450f, reversing
changes made to 91c0823ee6.
2024-05-31 00:22:40 +00:00
Camille GILLOT 5fa0ec6ad1 Enable DestinationPropagation by default. 2024-05-29 23:54:57 +00:00
Scott McMurray d05545c05d At debuginfo=0, don't inline debuginfo when inlining 2024-04-18 09:35:35 -07: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 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
Ralf Jung b58f647d54 rename ptr::invalid -> ptr::without_provenance
also introduce ptr::dangling matching NonNull::dangling
2024-02-21 20:15:52 +01:00
Camille GILLOT 1f544ca0cc Fold consecutive PtrToPtr casts. 2024-02-09 21:01:56 +00:00
Ben Kimock 611c3cb561 Bless/fix tests 2024-02-08 19:56:30 -05:00
Camille GILLOT 0aedd6e86f Sandwich MIR optimizations between DSE. 2024-01-11 09:58:19 +00:00
Caleb Zulawski 4d9607869a Update std::simd usage and test outputs 2023-11-26 09:02:25 -05:00
Scott McMurray 34732e8560 Get !nonnull metadata consistently in slice iterators, without needing assumes 2023-07-20 11:33:49 -07:00
Camille GILLOT 4de2d8fb66 Perform reference propagation earlier. 2023-07-10 16:01:18 +00:00
Nilstrieb 2beabbbf6f Rename adjustment::PointerCast and variants using it to PointerCoercion
It makes it sound like the `ExprKind` and `Rvalue` are supposed to represent all pointer related
casts, when in reality their just used to share a some enum variants. Make it clear there these
are only coercion to make it clear why only some pointer related "casts" are in the enum.
2023-07-07 18:17:16 +02:00
Ben Kimock 0a1fa411ed Remove comments from mir-opt MIR dumps 2023-06-15 15:19:11 -04:00
Pietro Albini 4668123945 bless mir-opt
To reproduce the changes in this commit locally:

- Run `./x test tidy` and remove all the output files not associated
  with a test file anymore, as reported by tidy.
- Run `./x test tests/mir-opt --bless` to generate the new outputs.
2023-06-12 09:34:17 +02:00