https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102008
Bug ID: 102008 Summary: [12 Regression] no cmov generated for loads next to each other Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Target: x86_64-*-* Take: struct Foo { int a; int b; }; int test(int side, const Foo *foo) { if (side == 1) return foo->a; return foo->b; } ----- CUT ---- Before r12-897, GCC was able to produce a cmov for this case but now we don't. Note for aarch64 we produce now: cmp w0, 1 add x0, x1, 4 csel x0, x0, x1, ne ldr w0, [x0] Which is actually reasonible still. Note I noticed this while looking into PR 68274.