about summary refs log tree commit diff
path: root/src/test/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstCombine.diff
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-85/+0
2022-09-26address reviewb-naber-3/+3
2022-08-22bless mir-opt testsNilstrieb-37/+37
2022-07-28bless mir opt testsNilstrieb-52/+52
2022-07-09tweak names and output and blessRalf Jung-3/+3
2022-07-04Don't use match-destructuring for derived ops on structs.Nicholas Nethercote-66/+46
All derive ops currently use match-destructuring to access fields. This is reasonable for enums, but sub-optimal for structs. E.g.: ``` fn eq(&self, other: &Point) -> bool { match *other { Self { x: ref __self_1_0, y: ref __self_1_1 } => match *self { Self { x: ref __self_0_0, y: ref __self_0_1 } => (*__self_0_0) == (*__self_1_0) && (*__self_0_1) == (*__self_1_1), }, } } ``` This commit changes derive ops on structs to use field access instead, e.g.: ``` fn eq(&self, other: &Point) -> bool { self.x == other.x && self.y == other.y } ``` This is faster to compile, results in smaller binaries, and is simpler to generate. Unfortunately, we have to keep the old pattern generating code around for `repr(packed)` structs because something like `&self.x` (which doesn't show up in `PartialEq` ops, but does show up in `Debug` and `Hash` ops) isn't allowed. But this commit at least changes those cases to use let-destructuring instead of match-destructuring, e.g.: ``` fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { { let Self(ref __self_0_0) = *self; { ::core::hash::Hash::hash(&(*__self_0_0), state) } } } ``` There are some unnecessary blocks remaining in the generated code, but I will fix them in a follow-up PR.
2022-04-16Switch some tests over to new MIR opt unit testsJakob Degen-0/+24
2022-04-11Fix tests broken by deaggregation changeJakob Degen-0/+1
2022-03-10Disable the test on wasm32Scott McMurray-51/+51
Since the expected output has unwind targets
2022-03-10mir-opt: Replace clone on primitives with copyScott McMurray-0/+80
We can't do it for everything, but it would be nice to at least stop making calls to clone methods in debug from things like derived-clones.