OSDN Git Service

2006-08-22 Daniel Berlin <dberlin@dberlin.org>
authordberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 22 Aug 2006 14:04:16 +0000 (14:04 +0000)
committerdberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 22 Aug 2006 14:04:16 +0000 (14:04 +0000)
PR tree-optimization/28003
* tree-ssa-alias.c (compute_may_aliases): Compute call clobbered
before grouping aliases.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116323 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/g++.dg/tree-ssa/pr28003.C [new file with mode: 0644]
gcc/tree-ssa-alias.c

index 136ba9d..3e4e388 100644 (file)
@@ -1,3 +1,9 @@
+2006-08-22  Daniel Berlin  <dberlin@dberlin.org>
+
+       PR tree-optimization/28003
+       * tree-ssa-alias.c (compute_may_aliases): Compute call clobbered
+       before grouping aliases.
+
 2006-08-22  Roger Sayle  <roger@eyesopen.com>
 
        * config/i386/i386.c (ix86_value_regno): Don't return FIRST_MMX_REG
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr28003.C b/gcc/testsuite/g++.dg/tree-ssa/pr28003.C
new file mode 100644 (file)
index 0000000..ff260bc
--- /dev/null
@@ -0,0 +1,31 @@
+// PR tree-optimization/28003
+// Alias grouping needs to be computed after call clobbering, because it
+// changes around the tags and variables in a way that makes our
+// call clobbering computation incorrect.
+// { dg-do run }
+// { dg-options "-O2" }
+extern "C" void abort(void);
+struct A
+{
+  int i, j[9];
+  A() : i(1) { j[0]=j[1]=j[2]=j[3]=j[4]=j[5]=j[6]=j[7]=j[8]=0; }
+};
+
+struct B
+{
+  A a;
+};
+
+B b[] =
+{
+  {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
+  {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
+  {}, {}, {}, {}, {}
+};
+
+int main()
+{
+  if (1 - b[sizeof(b)/sizeof(B) - 1].a.i != 0)
+    abort();
+  return 0;
+}
index cf5ed4e..d3c5700 100644 (file)
@@ -678,14 +678,14 @@ compute_may_aliases (void)
   /* Compute type-based flow-insensitive aliasing for all the type
      memory tags.  */
   compute_flow_insensitive_aliasing (ai);
+  
+  /* Compute call clobbering information.  */
+  compute_call_clobbered (ai);
 
   /* Determine if we need to enable alias grouping.  */
   if (ai->total_alias_vops >= MAX_ALIASED_VOPS)
     group_aliases (ai);
 
-  /* Compute call clobbering information.  */
-  compute_call_clobbered (ai);
-
   /* If the program has too many call-clobbered variables and/or function
      calls, create .GLOBAL_VAR and use it to model call-clobbering
      semantics at call sites.  This reduces the number of virtual operands