split-path: Improve ifcvt heurstic for split path [PR112402]
This simplifies the heurstic for split path to see if the join
bb is a ifcvt candidate.
For the predecessors bbs need either to be empty or only have one
statement in them which could be a decent ifcvt candidate.
The previous heurstics would miss that:
```
if (a) goto B else goto C;
B: goto C;
C:
c = PHI<d,e>
```
Would be a decent ifcvt candidate. And would also miss:
```
if (a) goto B else goto C;
B: d = f + 1; goto C;
C:
c = PHI<d,e>
```
Also since currently the max number of cmovs being able to produced is 3, we
should only assume `<= 3` phis can be ifcvt candidates.
The testcase changes for split-path-6.c is that lookharder function
is a true ifcvt case where we would get cmov as expected; it looks like it
was not a candidate when the heurstic was added but became one later on.
pr88797.C is now rejected via it being an ifcvt candidate rather than being about
DCE/const prop.
The rest of the testsuite changes are just slight change in the dump,
removing the "*diamnond" part as it was removed from the print.
Bootstrapped and tested on x86_64.
PR tree-optimization/112402
gcc/ChangeLog:
* gimple-ssa-split-paths.cc (poor_ifcvt_pred): New function.
(is_feasible_trace): Remove old heurstics for ifcvt cases.
For num_stmts <=1 for both pred check poor_ifcvt_pred on both
pred.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/split-path-11.c: Update scan.
* gcc.dg/tree-ssa/split-path-2.c: Update scan.
* gcc.dg/tree-ssa/split-path-5.c: Update scan.
* gcc.dg/tree-ssa/split-path-6.c: Update scan.
* g++.dg/tree-ssa/pr88797.C: Update scan.
* gcc.dg/tree-ssa/split-path-13.c: New test.
Signed-off-by:
Andrew Pinski <quic_apinski@quicinc.com>
Showing
- gcc/gimple-ssa-split-paths.cc 55 additions, 117 deletionsgcc/gimple-ssa-split-paths.cc
- gcc/testsuite/g++.dg/tree-ssa/pr88797.C 1 addition, 1 deletiongcc/testsuite/g++.dg/tree-ssa/pr88797.C
- gcc/testsuite/gcc.dg/tree-ssa/split-path-11.c 1 addition, 1 deletiongcc/testsuite/gcc.dg/tree-ssa/split-path-11.c
- gcc/testsuite/gcc.dg/tree-ssa/split-path-13.c 26 additions, 0 deletionsgcc/testsuite/gcc.dg/tree-ssa/split-path-13.c
- gcc/testsuite/gcc.dg/tree-ssa/split-path-2.c 1 addition, 1 deletiongcc/testsuite/gcc.dg/tree-ssa/split-path-2.c
- gcc/testsuite/gcc.dg/tree-ssa/split-path-5.c 1 addition, 1 deletiongcc/testsuite/gcc.dg/tree-ssa/split-path-5.c
- gcc/testsuite/gcc.dg/tree-ssa/split-path-6.c 3 additions, 1 deletiongcc/testsuite/gcc.dg/tree-ssa/split-path-6.c
Loading
Please register or sign in to comment