Commit graph

4 commits

Author SHA1 Message Date
Scott McMurray
b421a56364 Make the aggregate-then-transmute handling more general 2025-01-08 18:46:31 -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
03650dd029 Use layout information to detect transparent transmutes 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