https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120050
--- Comment #6 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
Before ext-dce:
(insn 421 420 422 43 (set (reg:DI 523 [ i ])
(sign_extend:DI (reg:SI 423 [ _144 ]))) 238 {extendsidi2}
(expr_list:REG_DEAD (reg:SI 423 [ _144 ])
(nil)))
(insn 440 439 441 45 (set (reg:SI 431 [ i ])
(subreg/s/u:SI (reg:DI 523 [ i ]) 0)) "../../gcc/gcc/genhooks.cc":198:8
323 {*movsi_internal}
(nil))
(jump_insn 441 440 442 45 (set (pc)
(if_then_else (eq (reg:SI 430 [ shp_91->pos ])
(reg:SI 431 [ i ]))
(label_ref 448)
(pc))) "../../gcc/gcc/genhooks.cc":198:8 487 {*branch_equalitysi}
(expr_list:REG_DEAD (reg:SI 431 [ i ])
(expr_list:REG_DEAD (reg:SI 430 [ shp_91->pos ])
(int_list:REG_BR_PROB 548896828 (nil))))
-> 448)
After ext-dce, insns 421 and 440 become:
(insn 421 420 422 43 (set (reg:DI 523 [ i ])
(subreg:DI (reg:SI 423 [ _144 ]) 0)) 321 {*movdi_64bit}
(expr_list:REG_DEAD (reg:SI 423 [ _144 ])
(nil)))
(insn 440 439 441 45 (set (reg:SI 431 [ i ])
(subreg/u:SI (reg:DI 523 [ i ]) 0)) "../../gcc/gcc/genhooks.cc":198:8
323 {*movsi_internal}
(nil))
i.e. the extension in 421 is changed to subreg and "/s" in 440 is removed.
Anyway 440 is really suspicious regarding MIPS's TARGET_MODE_REP_EXTENDED
mandates SImode to be represented in sign-extended form. Was 440 already
incorrect before ext-dce? Or was it correct but then it's broken by ext-dce?
Or is it still correct after ext-dce but then the later passes would do some
incorrect thing?