aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa.c
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@redhat.com>2004-09-17 18:42:51 +0000
committerDiego Novillo <dnovillo@gcc.gnu.org>2004-09-17 14:42:51 -0400
commit7eae8eb2b14e45981c040b77fcdbb477572c0403 (patch)
tree27e1b430d361c79a35303c66e5546cdc110af717 /gcc/tree-ssa.c
parent98c3a782774396163f6bcacf91515131e3abe375 (diff)
downloadgcc-7eae8eb2b14e45981c040b77fcdbb477572c0403.zip
gcc-7eae8eb2b14e45981c040b77fcdbb477572c0403.tar.gz
gcc-7eae8eb2b14e45981c040b77fcdbb477572c0403.tar.bz2
re PR tree-optimization/17273 (ICE in get_indirect_ref_operands)
PR tree-optimization/17273 * tree-ssa.c (replace_immediate_uses): Call fold_stmt if the replacement is a constant. testsuite/ChangeLog PR tree-optimization/17273 * gcc.c-torture/compile/pr17273.c: New test. From-SVN: r87662
Diffstat (limited to 'gcc/tree-ssa.c')
-rw-r--r--gcc/tree-ssa.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index 3e9b213..f79466d 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -1018,6 +1018,25 @@ replace_immediate_uses (tree var, tree repl)
propagate_value (use_p, repl);
}
+ /* FIXME. If REPL is a constant, we need to fold STMT.
+ However, fold_stmt wants a pointer to the statement, because
+ it may happen that it needs to replace the whole statement
+ with a new expression. Since the current def-use machinery
+ does not return pointers to statements, we call fold_stmt
+ with the address of a local temporary, if that call changes
+ the temporary then we fall on our swords.
+
+ Note that all this will become unnecessary soon. This
+ pass is being replaced with a proper copy propagation pass
+ for 4.1 (dnovillo, 2004-09-17). */
+ if (TREE_CODE (repl) != SSA_NAME)
+ {
+ tree tmp = stmt;
+ fold_stmt (&tmp);
+ if (tmp != stmt)
+ abort ();
+ }
+
/* If REPL is a pointer, it may have different memory tags associated
with it. For instance, VAR may have had a name tag while REPL
only had a type tag. In these cases, the virtual operands (if