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

Bob Wilson bob.wilson at apple.com
Fri Sep 4 16:44:34 PDT 2009


Author: bwilson
Date: Fri Sep  4 18:44:31 2009
New Revision: 81054

URL: http://llvm.org/viewvc/llvm-project?rev=81054&view=rev
Log:
Preserve alignment settings for string constants.  This fixes
<rdar://problem/7197868> where llvm-gcc was setting the alignment for
a memcpy intrinsic based on the string's alignment but then ignoring
the alignment when emitting the string itself.

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=81054&r1=81053&r2=81054&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Fri Sep  4 18:44:31 2009
@@ -7992,7 +7992,11 @@
                                           GlobalVariable::PrivateLinkage, Init,
                                           ".str");
 
-  GV->setAlignment(TYPE_ALIGN(TREE_TYPE(exp)) / 8);
+  unsigned align = TYPE_ALIGN(TREE_TYPE(exp));
+#ifdef CONSTANT_ALIGNMENT
+  align = CONSTANT_ALIGNMENT (exp, align);
+#endif
+  GV->setAlignment(align / 8);
 
   if (SlotP) *SlotP = GV;
   return GV;





More information about the llvm-commits mailing list