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

Eric Christopher echristo at apple.com
Tue Jul 20 21:53:16 PDT 2010


Author: echristo
Date: Tue Jul 20 23:53:15 2010
New Revision: 108986

URL: http://llvm.org/viewvc/llvm-project?rev=108986&view=rev
Log:
Make this error message dependent upon alignments set only
by attribute as well as triggering on more code.  Only
by attribute solves problems that could occur via vector
spill.

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=108986&r1=108985&r2=108986&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Jul 20 23:53:15 2010
@@ -820,8 +820,8 @@
   // every time we see a variable.
   if (SeenVLA &&
       GreatestAlignment > TheTarget->getFrameInfo()->getStackAlignment())
-      error ("alignment for %q+D conflicts with either a dynamically "
-             "realigned stack or the maximum stack alignment", SeenVLA);
+      error ("alignment for %q+D conflicts with a dynamically realigned stack",
+             SeenVLA);
 
   return Fn;
 }
@@ -1772,13 +1772,6 @@
       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))
@@ -1828,6 +1821,18 @@
       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));
@@ -1847,10 +1852,6 @@
 
   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