https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126026
Bug ID: 126026
Summary: phiprop should handle `a = PHI<&l0, &l1, &l2>;
`bb:`goto *a;`
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: pinskia at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Blocks: 126010
Target Milestone: ---
Created attachment 64886
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64886&action=edit
testcase from the testsuite
```
<bb 4> [local count: 1073741824]:
# PT = null
# p_1 = PHI <&L0(3), &L1(2)>
# RANGE [irange] int [1, 1][3, 3][5, 5][7, 7] MASK 0x6 VALUE 0x1
# b_2 = PHI <3(3), 5(2)>
goto p_1;
```
should be handled by phiprop.
gcc.dg/tree-ssa/pr18133-2.c fails if we turn off DOM.
Currently DOM handles it.
The question comes how many statements should be duplicated.
DOM looks like only duplicates just one BB and that is it.
So inside the testcase if you add:
```
if (g)
f();
if (g1)
f();
```
Right before the goto, DOM does not optimize it at all.
To begin with I am just going to duplicate one basic block with no statements
(except for the goto). And later on we can add a more complex heurstic if
needed.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126010
[Bug 126010] [meta-bug] Remove DOM