]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ipa-reference.c (analyze_function): Consider also addresses taken in phi nodes.
authorZdenek Dvorak <rakdver@gcc.gnu.org>
Sat, 13 Jan 2007 19:12:39 +0000 (19:12 +0000)
committerZdenek Dvorak <rakdver@gcc.gnu.org>
Sat, 13 Jan 2007 19:12:39 +0000 (19:12 +0000)
* ipa-reference.c (analyze_function): Consider also addresses taken
in phi nodes.

* gcc.dg/20070112-1.c: New test.

From-SVN: r120757

gcc/ChangeLog
gcc/ipa-reference.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/20070112-1.c [new file with mode: 0644]

index fcaf921c281ddab39d77f92acd54935e0aad7243..e18dfd6f4b66c4011b7212f43ca864843afd9dd5 100644 (file)
@@ -1,3 +1,8 @@
+2007-01-13  Zdenek Dvorak <dvorakz@suse.cz>
+
+       * ipa-reference.c (analyze_function): Consider also addresses taken
+       in phi nodes.
+
 2007-01-12  Roger Sayle  <roger@eyesopen.com>
 
        * c-typeck.c (null_pointer_constant_p): Replace use of
index 8602afda0b02305acf34ada969d3826f905de167..b1ff849082e48473f0cd66c57c9df5dc16935909 100644 (file)
@@ -807,6 +807,21 @@ analyze_function (struct cgraph_node *fn)
     FOR_EACH_BB_FN (this_block, this_cfun)
       {
        block_stmt_iterator bsi;
+       tree phi, op;
+       use_operand_p use;
+       ssa_op_iter iter;
+
+       /* Find the addresses taken in phi node arguments.  */
+       for (phi = phi_nodes (this_block); phi; phi = PHI_CHAIN (phi))
+         {
+           FOR_EACH_PHI_ARG (use, phi, iter, SSA_OP_USE)
+             {
+               op = USE_FROM_PTR (use);
+               if (TREE_CODE (op) == ADDR_EXPR)
+                 check_rhs_var (l, op);
+             }
+         }
+
        for (bsi = bsi_start (this_block); !bsi_end_p (bsi); bsi_next (&bsi))
          walk_tree (bsi_stmt_ptr (bsi), scan_for_static_refs, 
                     fn, visited_nodes);
index 41ebdf22570196dfff9da43fde36ac1ec2805f65..7c3b7698730cd4e88a8fa5602c759213e544cabb 100644 (file)
@@ -1,3 +1,7 @@
+2007-01-13  Zdenek Dvorak <dvorakz@suse.cz>
+
+       * gcc.dg/20070112-1.c: New test.
+
 2007-01-12  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR libgfortran/30435
@@ -5,7 +9,7 @@
 
 2007-01-12  Olga Golovanevsky  <olga@il.ibm.com>
 
-        * gcc.dg/torture/pr24750-1.c:  Add prototype of free.
+       * gcc.dg/torture/pr24750-1.c:  Add prototype of free.
 
 2007-01-12  Tom Tromey  <tromey@redhat.com>
 
diff --git a/gcc/testsuite/gcc.dg/20070112-1.c b/gcc/testsuite/gcc.dg/20070112-1.c
new file mode 100644 (file)
index 0000000..bd78335
--- /dev/null
@@ -0,0 +1,24 @@
+/* We used to ICE on this testcase: the address of bad_spill_regs is
+   only taken in a phi node, which we missed and cleared its TREE_ADDRESSABLE
+   flag.  This gets revealed when the loop is completely unrolled, thus
+   exposing the addresses as ordinary statements.  */
+
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+
+
+typedef unsigned HARD_REG_SET[2];
+static HARD_REG_SET bad_spill_regs;
+
+void
+order_regs_for_reload ()
+{
+  register int i;
+
+  register unsigned *scan_tp_ = bad_spill_regs;
+
+  for (i = 0; i < 2; i++)
+    *scan_tp_++ = 0;
+
+  bad_spill_regs[0] |= 1;
+}