https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112760
Uroš Bizjak <ubizjak at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|target |rtl-optimization
Last reconfirmed| |2023-11-29
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Target Milestone|--- |14.0
--- Comment #2 from Uroš Bizjak <ubizjak at gmail dot com> ---
With the original testcase, ce1 pass is if-converting:
20: flags:CCZ=cmp(r110:SI,r111:SI)
REG_DEAD r111:SI
REG_DEAD r110:SI
21: pc={(flags:CCZ==0)?L23:pc}
REG_DEAD flags:CCZ
39: NOTE_INSN_BASIC_BLOCK 5
22: r103:HI=0x1
23: L23:
with:
IF-THEN-JOIN block found, pass 2, test 2, then 5, join 6
scanning new insn with uid = 45.
scanning new insn with uid = 44.
scanning new insn with uid = 46.
if-conversion succeeded through noce_try_cmove
Removing jump 21.
deleting insn with uid = 21.
deleting insn with uid = 22.
to:
20: flags:CCZ=cmp(r110:SI,r111:SI)
REG_DEAD r111:SI
REG_DEAD r110:SI
45: r118:HI=0x1
44: flags:CCZ=cmp(r110:SI,r111:SI)
46: r103:HI={(flags:CCZ==0)?r103:HI:r118:HI}
And things go downhill from here. Before postreload we have:
20: flags:CCZ=cmp(ax:SI,dx:SI)
REG_UNUSED flags:CCZ
44: flags:CCZ=cmp(ax:SI,dx:SI)
REG_DEAD dx:SI
REG_DEAD ax:SI
62: ax:HI=0x1
REG_EQUIV 0x1
46: bx:HI={(flags:CCZ==0)?bx:HI:ax:HI}
REG_DEAD flags:CCZ
REG_DEAD ax:HI
and in posteload pass (insn 44) is removed:
20: flags:CCZ=cmp(ax:SI,dx:SI)
REG_UNUSED flags:CCZ
62: ax:HI=0x1
REG_EQUIV 0x1
46: bx:HI={(flags:CCZ==0)?bx:HI:ax:HI}
REG_DEAD flags:CCZ
REG_DEAD ax:HI
here comes pro_and_epilogue pass that detects "unused" (insn 20) and removes
it:
df_analyze called
deleting insn with uid = 20.
Confirmed as RTL optimization problem.