mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 23:25:24 +02:00
tree-optimization/124692 - update stmt before folding
The following makes sure SSA operands are up-to-date before folding. Esp. when replace_uses_by is invoked from SCEV cprop which now has ranger enabled we can otherwise end up ICEing where purpoted SSA names now are constants. This follows what forwprop does. PR tree-optimization/124692 * tree-cfg.cc (replace_uses_by): Call update_stmt after substitution and before folding. * gcc.dg/torture/pr124692.c: New testcase.
This commit is contained in:
committed by
Richard Biener
parent
b95bfa1ff2
commit
b82bc657de
22
gcc/testsuite/gcc.dg/torture/pr124692.c
Normal file
22
gcc/testsuite/gcc.dg/torture/pr124692.c
Normal file
@@ -0,0 +1,22 @@
|
||||
/* { dg-do compile } */
|
||||
|
||||
int a, b, d, e[3][1], f, g, h;
|
||||
unsigned c;
|
||||
int main()
|
||||
{
|
||||
while (b)
|
||||
{
|
||||
h = g;
|
||||
for (b = 0; b < 2; b++)
|
||||
;
|
||||
for (; c; c++)
|
||||
{
|
||||
int j = e[b][h];
|
||||
f = a < 0 ? j : j - a;
|
||||
if (!f)
|
||||
break;
|
||||
g = c;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1988,14 +1988,16 @@ replace_uses_by (tree name, tree val)
|
||||
if (op && TREE_CODE (op) == ADDR_EXPR)
|
||||
recompute_tree_invariant_for_addr_expr (op);
|
||||
}
|
||||
update_stmt (stmt);
|
||||
|
||||
if (fold_stmt (&gsi))
|
||||
stmt = gsi_stmt (gsi);
|
||||
{
|
||||
stmt = gsi_stmt (gsi);
|
||||
update_stmt (stmt);
|
||||
}
|
||||
|
||||
if (maybe_clean_or_replace_eh_stmt (orig_stmt, stmt))
|
||||
gimple_purge_dead_eh_edges (gimple_bb (stmt));
|
||||
|
||||
update_stmt (stmt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user