https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68194
--- Comment #2 from ktkachov at gcc dot gnu.org --- Created attachment 36640 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36640&action=edit cprop dump before the suspected bad transformation Confirmed the failure. However I think the cited revision (RTL if-conversion change) exposes another bug. I think cse goes wrong and ends up CSEing a memory load from a symbol_ref to 'f': (insn 67 66 68 13 (set (reg:HI 108 [ f ]) (mem/c:HI (symbol_ref:DI ("f") [flags 0x2] <var_decl 0x7f6a29585c60 f>) [2 f+0 S2 A16])) fail.c:28 88 {*movhi_internal} (nil)) (insn 68 67 69 13 (set (reg:SI 109 [ f ]) (sign_extend:SI (subreg:QI (reg:HI 108 [ f ]) 0))) fail.c:28 146 {extendqisi2} (expr_list:REG_DEAD (reg:HI 108 [ f ]) (nil))) in basic block 13 gets transformed to: (insn 68 66 69 13 (set (reg:SI 109 [ f ]) (sign_extend:SI (subreg:QI (reg:HI 112 [ f ]) 0))) fail.c:28 146 {extendqisi2} (expr_list:REG_DEAD (reg:HI 108 [ f ]) (nil))) because (symbol_ref:DI ("f") gets loaded into reg 112 in another basic block (bb 8). This seems bogus to me. Indeed, adding -fno-rerun-cse-after-loop (the flag controlling cse2) to the flags makes the testcase pass