diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-04-27 10:36:35 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-04-27 10:36:35 +0000 |
commit | c5321600b202ca49176d05110038b12b66372c67 (patch) | |
tree | 142f31f3a698f56976833b06a17ce1c8559e0869 /gcc/tree-ssa-pre.c | |
parent | 9c455d1e21df04e48119032c3d6757e9a8b09771 (diff) | |
download | gcc-c5321600b202ca49176d05110038b12b66372c67.tar.gz |
2011-04-27 Richard Guenther <rguenther@suse.de>
PR tree-optimization/48772
* tree-ssa-pre.c (eliminate): Update call stmts after elimination
only.
* g++.dg/pr48772.C: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@173019 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-pre.c')
-rw-r--r-- | gcc/tree-ssa-pre.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index a833a041bbb..51d9dcde9af 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -4186,6 +4186,7 @@ static unsigned int eliminate (void) { VEC (gimple, heap) *to_remove = NULL; + VEC (gimple, heap) *to_update = NULL; basic_block b; unsigned int todo = 0; gimple_stmt_iterator gsi; @@ -4411,7 +4412,7 @@ eliminate (void) } gimple_call_set_fn (stmt, fn); - update_stmt (stmt); + VEC_safe_push (gimple, heap, to_update, stmt); /* When changing a call into a noreturn call, cfg cleanup is needed to fix up the noreturn call. */ @@ -4563,6 +4564,13 @@ eliminate (void) } VEC_free (gimple, heap, to_remove); + /* We cannot update call statements with virtual operands during + SSA walk. This might remove them which in turn makes our + VN lattice invalid. */ + FOR_EACH_VEC_ELT (gimple, to_update, i, stmt) + update_stmt (stmt); + VEC_free (gimple, heap, to_update); + return todo; } |