https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107385
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed| |2022-10-24 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Expand is doing: (insn 3 24 9 6 (set (reg/v:SI 82 [ <retval> ]) (const_int 6 [0x6])) "/app/example.cpp":4:7 -1 (nil)) (insn 9 3 14 6 (set (reg/v:SI 82 [ <retval> ]) (reg:SI 83 [ x ])) "/app/example.cpp":3:5 -1 (nil)) >From this IR: <bb 2> [local count: 1073741824]: __asm__ goto("//" : "=r" x_2 : : : "bar" <L3>); goto <bb 4>; [35.00%] <bb 3> [local count: 697932184]: <L3>: <bb 4> [local count: 1073741824]: # x_1 = PHI <x_2(3), 6(2)> bar: Note 6 does not need to be a constant here, it could be anything. I suspect when the inline-asm goto is being expanded, it adds the assignment to reg 82 on all edges going out of the inline-asm but then messing up because there is some extra code due to the phi node.