[llvm-commits] [llvm] r129466 - in /llvm/trunk: lib/Target/TargetData.cpp test/CodeGen/X86/alignment.ll test/CodeGen/X86/unaligned-load.ll

Cameron Zwarich zwarich at apple.com
Wed Apr 13 13:36:04 PDT 2011


Author: zwarich
Date: Wed Apr 13 15:36:04 2011
New Revision: 129466

URL: http://llvm.org/viewvc/llvm-project?rev=129466&view=rev
Log:
Fix a regression caused by r102515 where explicit alignment on globals is
ignored. There was a test to catch this, but it was just blindly updated in
a large change. This fixes another part of <rdar://problem/9275290>.

Modified:
    llvm/trunk/lib/Target/TargetData.cpp
    llvm/trunk/test/CodeGen/X86/alignment.ll
    llvm/trunk/test/CodeGen/X86/unaligned-load.ll

Modified: llvm/trunk/lib/Target/TargetData.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetData.cpp?rev=129466&r1=129465&r2=129466&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetData.cpp (original)
+++ llvm/trunk/lib/Target/TargetData.cpp Wed Apr 13 15:36:04 2011
@@ -624,7 +624,7 @@
     Alignment = std::max(GVAlignment, getABITypeAlignment(ElemType));
   }
 
-  if (GV->hasInitializer()) {
+  if (GV->hasInitializer() && GVAlignment == 0) {
     if (Alignment < 16) {
       // If the global is not external, see if it is large.  If so, give it a
       // larger alignment.

Modified: llvm/trunk/test/CodeGen/X86/alignment.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/alignment.ll?rev=129466&r1=129465&r2=129466&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/alignment.ll (original)
+++ llvm/trunk/test/CodeGen/X86/alignment.ll Wed Apr 13 15:36:04 2011
@@ -6,7 +6,7 @@
 
 ; CHECK:	.bss
 ; CHECK:	.globl	GlobalA
-; CHECK:	.align	16
+; CHECK:	.align	8
 ; CHECK: GlobalA:
 ; CHECK:	.zero	384
 
@@ -15,12 +15,12 @@
 ; PR6921
 @GlobalB = common global { [384 x i8] } zeroinitializer, align 8
 
-; CHECK: 	.comm	GlobalB,384,16
+; CHECK: 	.comm	GlobalB,384,8
 
 
 @GlobalC = common global { [384 x i8] } zeroinitializer, align 2
 
-; CHECK: 	.comm	GlobalC,384,16
+; CHECK: 	.comm	GlobalC,384,2
 
 
 

Modified: llvm/trunk/test/CodeGen/X86/unaligned-load.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/unaligned-load.ll?rev=129466&r1=129465&r2=129466&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/unaligned-load.ll (original)
+++ llvm/trunk/test/CodeGen/X86/unaligned-load.ll Wed Apr 13 15:36:04 2011
@@ -29,8 +29,8 @@
 declare void @llvm.memcpy.i64(i8* nocapture, i8* nocapture, i64, i32) nounwind
 
 ; CORE2: .section
-; CORE2: .align  4
+; CORE2: .align  3
 ; CORE2-NEXT: _.str1:
 ; CORE2-NEXT: .asciz "DHRYSTONE PROGRAM, SOME STRING"
-; CORE2: .align 4
+; CORE2: .align 3
 ; CORE2-NEXT: _.str3:





More information about the llvm-commits mailing list