While collapsing all basic blocks inside one loop, tree-if-
conversion accidently removes latch. This happens when it is handed
over following CFG for the example test case.
[0]---->[2]---->[3]---->[4]
/\ | |
| | |
| \/ |
[1]<-----+
There is not any easy way to collapse this into a loop with 2
blocks where [2] is loop-header. This patch updates tree-if-
conversion to screen and avoid such loops.
PR tree-optimization/23048
* tree-if-conv.c (if_convertible_bb_p): Supply basic_block
as third parameter.
Check whether latch is dominated by exit block or not.
(if_convertible_loop_p): Supply exit block itself to
if_convertible_bb_p.
* gcc.dg/tree-ssa/pr23048.c: New.
:ADDPATCH SSA:
Bootstrapped and tested on powerpc-apple-darwin.
OK?
-
Devang
<pr23048.diff>