[llvm-commits] [llvm-gcc-4.2] r109692 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Eric Christopher
echristo at apple.com
Wed Jul 28 16:16:18 PDT 2010
Author: echristo
Date: Wed Jul 28 18:16:18 2010
New Revision: 109692
URL: http://llvm.org/viewvc/llvm-project?rev=109692&view=rev
Log:
Revert 109684 and add a patch to make sure we're only computing the type
for the alignment for var decls we're not going to use anyways.
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=109692&r1=109691&r2=109692&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Wed Jul 28 18:16:18 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))
@@ -1795,8 +1788,11 @@
TODO(decl);
abort();
}
- } else if (TREE_CODE(DECL_SIZE_UNIT(decl)) == INTEGER_CST) {
- // Variable of fixed size that goes on the stack.
+ } else if (TREE_CODE(DECL_SIZE_UNIT(decl)) == INTEGER_CST
+ || (TREE_CODE(decl) == VAR_DECL && DECL_VALUE_EXPR(decl))) {
+ // Variable of fixed size that goes on the stack or the type for a
+ // variable we're not going to emit anyways, but need later for alignment
+ // calculations.
Ty = ConvertType(type);
} else {
// Dynamic-size object: must push space on the stack.
@@ -1828,6 +1824,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 +1855,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