[Bug tree-optimization/107823] [13 Regression] Dead Code Elimination Regression at -Os (trunk vs. 12.2.0)
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Nov 24 09:58:37 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107823
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|rguenth at gcc dot gnu.org |unassigned at gcc dot gnu.org
Status|ASSIGNED |NEW
CC| |aldyh at gcc dot gnu.org
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think it's working as intended now - in GCC 12 we did
Checking profitability of path (backwards): bb:4 (4 insns) bb:3 (latch)
Control statement insns: 2
Overall: 2 insns
[4] Registering jump thread: (3, 4) incoming edge; (4, 5) nocopy;
path: 3->4->5 SUCCESS
while on trunk we have
Checking profitability of path (backwards): bb:4 (4 insns) bb:3 (latch)
Control statement insns: 2
Overall: 2 insns
Checking profitability of path (backwards): FAIL: Jump-thread path not
considered: duplication of 2 insns is needed and optimizing for size.
path: 3->4->xx REJECTED
so the fix works exactly as intended.
The pattern of a loop where the control stmt is statically resolvable
both in the first and the second iteration would likely need special
heuristical treatment, allowing to see the full 2->4->3->4->5 thread
and anticipating elimination of the conditionals and the original
block copies. But the machinery isn't set up for this at all.
It works just fine at -O2.
More information about the Gcc-bugs
mailing list