tree-optimization/102893 - properly DCE empty loops inside infinite loops
The following fixes the test for an exit edge I put in place for the fix for PR45178 where I somehow misunderstood how the cyclic list works. 2021-10-22 Richard Biener <rguenther@suse.de> PR tree-optimization/102893 * tree-ssa-dce.c (find_obviously_necessary_stmts): Fix the test for an exit edge. * gcc.dg/tree-ssa/ssa-dce-9.c: New testcase.
This commit is contained in:
parent
8a0faddadd
commit
c2a9a98a36
2 changed files with 11 additions and 1 deletions
10
gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-9.c
Normal file
10
gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-9.c
Normal file
|
@ -0,0 +1,10 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -fdump-tree-cddce1" } */
|
||||
|
||||
int main()
|
||||
{
|
||||
while(1)
|
||||
for(int i=0; i<9000000; i++){}
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump-not "if" "cddce1" } } */
|
|
@ -436,7 +436,7 @@ find_obviously_necessary_stmts (bool aggressive)
|
|||
|
||||
for (auto loop : loops_list (cfun, 0))
|
||||
/* For loops without an exit do not mark any condition. */
|
||||
if (loop->exits->next && !finite_loop_p (loop))
|
||||
if (loop->exits->next->e && !finite_loop_p (loop))
|
||||
{
|
||||
if (dump_file)
|
||||
fprintf (dump_file, "cannot prove finiteness of loop %i\n",
|
||||
|
|
Loading…
Add table
Reference in a new issue