https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127143
Bug ID: 127143
Summary: cond_on_phi_p should support the cast between the phi
and the cond
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Created attachment 65454
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65454&action=edit
testcase
Since phiopt will factor out the int.
cond_on_phi_p/phi_arg_from_cmp_p does not handle that case.
They only handle the case where the factoring didn't happen.
Which was true when phi_arg_from_cmp_p was added back in
r10-1070-g1d53751dd563d3. But the factoring has happened since
r15-3992-g698e0ec89bc096 .
So what we get at phiopt1 is:
```
if (x_5(D) != 0)
goto <bb 3>; [INV]
else
goto <bb 4>; [INV]
<bb 3> :
_1 = a_9(D) < b_10(D);
goto <bb 5>; [INV]
<bb 4> :
_2 = c_6(D) < d_7(D);
<bb 5> :
# _14 = PHI <_1(3), _2(4)>
t_3 = (int) _14;
if (t_3 != 0)
```
So we should add support a cast/convert between the gcond and the phi in
cond_on_phi_p.