https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112454
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2023-11-18 Ever confirmed|0 |1 Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot gnu.org --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Mine, looks like a cost issue not recording that 1 (and ~0) are free to create. you can see the cost issue if we look at combine for the case of 1 csel: Trying 37 -> 39: 37: r98:SI=0x1 39: r92:SI={(cc:CC!=0)?r100:SI:r98:SI} REG_DEAD r100:SI REG_DEAD cc:CC REG_DEAD r98:SI Successfully matched this instruction: (set (reg:SI 92 [ <retval> ]) (if_then_else:SI (ne (reg:CC 66 cc) (const_int 0 [0])) (reg:SI 100) (const_int 1 [0x1]))) allowing combination of insns 37 and 39 original costs 4 + 4 = 8 replacement cost 8 deferring deletion of insn with uid = 37. modifying insn i3 39: r92:SI={(cc:CC!=0)?r100:SI:0x1} REG_DEAD cc:CC REG_DEAD r100:SI deferring rescan insn with uid = 39. The replacement cost should be still 4.