[llvm-commits] [llvm-gcc-4.2] r109684 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Stuart Hastings stuart at apple.com
Wed Jul 28 15:39:07 PDT 2010


Author: stuart
Date: Wed Jul 28 17:39:07 2010
New Revision: 109684

URL: http://llvm.org/viewvc/llvm-project?rev=109684&view=rev
Log:
Revert r108986; it was breaking 2004-06-18-VariableLengthArrayOfStructures.c.  Radar 8239581.

Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=109684&r1=109683&r2=109684&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Wed Jul 28 17:39:07 2010
@@ -820,8 +820,8 @@
   // every time we see a variable.
   if (SeenVLA &&
       GreatestAlignment > TheTarget->getFrameInfo()->getStackAlignment())
-      error ("alignment for %q+D conflicts with a dynamically realigned stack",
-             SeenVLA);
+      error ("alignment for %q+D conflicts with either a dynamically "
+             "realigned stack or the maximum stack alignment", SeenVLA);
 
   return Fn;
 }
@@ -1772,6 +1772,13 @@
       DECL_SIZE(decl) != 0 && TREE_CODE(DECL_SIZE_UNIT(decl)) != INTEGER_CST)
     SeenVLA = decl;
       
+  // If this is just the rotten husk of a variable that the gimplifier
+  // eliminated all uses of, but is preserving for debug info, ignore it.
+  // TODO: This affects the correctness of the warning we're attempting to
+  // watch above.
+  if (TREE_CODE(decl) == VAR_DECL && DECL_VALUE_EXPR(decl))
+    return;
+      
   // Gimple temporaries are handled specially: their DECL_LLVM is set when the
   // definition is encountered.
   if (isGimpleTemporary(decl))
@@ -1821,18 +1828,6 @@
       Alignment = DECL_ALIGN(decl) / 8;
   }
 
-  // Record the alignment if it's the largest we've seen and is explicitly
-  // requested.
-  if (DECL_USER_ALIGN(decl) && Alignment > GreatestAlignment)
-    GreatestAlignment = Alignment;
-
-  // If this is just the rotten husk of a variable that the gimplifier
-  // eliminated all uses of, but is preserving for debug info, ignore it.
-  // We're doing this late so that we can get the alignment information from
-  // the code.
-  if (TREE_CODE(decl) == VAR_DECL && DECL_VALUE_EXPR(decl))
-    return;
-      
   const char *Name;      // Name of variable
   if (DECL_NAME(decl))
     Name = IDENTIFIER_POINTER(DECL_NAME(decl));
@@ -1852,6 +1847,10 @@
 
   AI->setAlignment(Alignment);
   
+  // Record the alignment if it's the largest we've seen.
+  if (Alignment > GreatestAlignment)
+    GreatestAlignment = Alignment;
+
   SET_DECL_LLVM(decl, AI);
 
   // Handle annotate attributes





More information about the llvm-commits mailing list