aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/Target/TargetData.cpp2
-rw-r--r--test/CodeGen/X86/alignment.ll6
-rw-r--r--test/CodeGen/X86/unaligned-load.ll4
3 files changed, 6 insertions, 6 deletions
diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp
index da956d5..1990bc7 100644
--- a/lib/Target/TargetData.cpp
+++ b/lib/Target/TargetData.cpp
@@ -624,7 +624,7 @@ unsigned TargetData::getPreferredAlignment(const GlobalVariable *GV) const {
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.
diff --git a/test/CodeGen/X86/alignment.ll b/test/CodeGen/X86/alignment.ll
index 9678e6d..7e91115 100644
--- a/test/CodeGen/X86/alignment.ll
+++ b/test/CodeGen/X86/alignment.ll
@@ -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
diff --git a/test/CodeGen/X86/unaligned-load.ll b/test/CodeGen/X86/unaligned-load.ll
index 6a493c0..9f70489 100644
--- a/test/CodeGen/X86/unaligned-load.ll
+++ b/test/CodeGen/X86/unaligned-load.ll
@@ -29,8 +29,8 @@ return:
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: