https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91860
Jim Wilson <wilson at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wilson at gcc dot gnu.org --- Comment #1 from Jim Wilson <wilson at gcc dot gnu.org> --- Combine is doing a 3 instruction split into 2 which appears ok Trying 12, 14 -> 18: 12: r84:SI=0xa000 14: r76:DI=sign_extend(r84:SI+0x466) REG_DEAD r84:SI REG_EQUAL 0xa466 18: r87:DI=~r76:DI REG_DEAD r76:DI Failed to match this instruction: (set (reg:DI 87) (const_int -42087 [0xffffffffffff5b99])) Splitting with gen_split_11 (riscv.md:1280) Successfully matched this instruction: (set (reg:DI 76 [ _7 ]) (const_int -40960 [0xffffffffffff6000])) Successfully matched this instruction: (set (reg:DI 87) (plus:DI (reg:DI 76 [ _7 ]) (const_int -1127 [0xfffffffffffffb99]))) allowing combination of insns 12, 14 and 18 original costs 4 + 8 + 4 = 16 replacement costs 4 + 4 = 8 however a side effect of this is that when i1 is substituted into newpat, i2src becomes invalid RTL gdb) print i2src $74 = (rtx) 0x7ffff6262b90 (gdb) pr warning: Expression is not an assignment (and might have no effect) (sign_extend:DI (const_int 42086 [0xa466])) This wouldn't be a problem normally, except that i2src is later used to generate a debug instruction via propagate_for_debug. This calls simplify_replace_fn_rtx which crashes on the invalid rtl. Looks like we need to copy i2src sooner than we currently do.