Emit .local before .comm for bss to make llvm-mc happy.
Otherwise llvm-mc asserts. This is also the order that llc emits the directives.
Change a couple of RUIN -> RUN in lit tests.
BUG=none
R=stichnot@chromium.org
Review URL: https://codereview.chromium.org/469973002
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp
index a78e21a..75ea25d 100644
--- a/src/IceTargetLoweringX8632.cpp
+++ b/src/IceTargetLoweringX8632.cpp
@@ -4207,8 +4207,8 @@
// zeroinitializer (non-constant):
// (.section or .data as above)
- // .comm NAME, SIZE, ALIGN
// .local NAME
+ // .comm NAME, SIZE, ALIGN
IceString MangledName = Ctx->mangleName(Name);
// Start a new section.
@@ -4218,6 +4218,8 @@
Str << "\t.type\t" << MangledName << ",@object\n";
Str << "\t.data\n";
}
+ Str << "\t" << (IsInternal ? ".local" : ".global") << "\t" << MangledName
+ << "\n";
if (IsZeroInitializer) {
if (IsConst) {
Str << "\t.align\t" << Align << "\n";
@@ -4238,8 +4240,6 @@
}
Str << "\t.size\t" << MangledName << ", " << Size << "\n";
}
- Str << "\t" << (IsInternal ? ".local" : ".global") << "\t" << MangledName
- << "\n";
}
} // end of namespace Ice
diff --git a/tests_lit/llvm2ice_tests/convert.ll b/tests_lit/llvm2ice_tests/convert.ll
index 849ce8de..7a971ef 100644
--- a/tests_lit/llvm2ice_tests/convert.ll
+++ b/tests_lit/llvm2ice_tests/convert.ll
@@ -2,10 +2,10 @@
; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s
; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck %s
-; RUIN: %llvm2ice -O2 --verbose none %s \
-; RUIN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj
-; RUIN: %llvm2ice -Om1 --verbose none %s \
-; RUIN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj
+; RUN: %llvm2ice -O2 --verbose none %s \
+; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj
+; RUN: %llvm2ice -Om1 --verbose none %s \
+; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj
; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
diff --git a/tests_lit/llvm2ice_tests/globalinit.pnacl.ll b/tests_lit/llvm2ice_tests/globalinit.pnacl.ll
index 471f41f..f5657f5 100644
--- a/tests_lit/llvm2ice_tests/globalinit.pnacl.ll
+++ b/tests_lit/llvm2ice_tests/globalinit.pnacl.ll
@@ -1,13 +1,14 @@
; Test of global initializers.
; RUN: %llvm2ice --verbose inst %s | FileCheck %s
-; RUIN: %llvm2ice --verbose none %s \
-; RUIN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj
+; RUN: %llvm2ice --verbose none %s \
+; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj
; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
@PrimitiveInit = internal global [4 x i8] c"\1B\00\00\00", align 4
; CHECK: .data
+; CHECK-NEXT: .local
; CHECK-NEXT: .align 4
; CHECK-NEXT: PrimitiveInit:
; CHECK-NEXT: .byte
@@ -15,6 +16,7 @@
@PrimitiveInitConst = internal constant [4 x i8] c"\0D\00\00\00", align 4
; CHECK: .section .rodata,"a",@progbits
+; CHECK-NEXT: .local
; CHECK-NEXT: .align 4
; CHECK-NEXT: PrimitiveInitConst:
; CHECK-NEXT: .byte
@@ -22,6 +24,7 @@
@ArrayInit = internal global [20 x i8] c"\0A\00\00\00\14\00\00\00\1E\00\00\00(\00\00\002\00\00\00", align 4
; CHECK: .data
+; CHECK-NEXT: .local
; CHECK-NEXT: .align 4
; CHECK-NEXT: ArrayInit:
; CHECK-NEXT: .byte
@@ -29,6 +32,7 @@
@ArrayInitPartial = internal global [40 x i8] c"<\00\00\00F\00\00\00P\00\00\00Z\00\00\00d\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", align 4
; CHECK: .data
+; CHECK-NEXT: .local
; CHECK-NEXT: .align 4
; CHECK-NEXT: ArrayInitPartial:
; CHECK-NEXT: .byte
@@ -36,21 +40,22 @@
@PrimitiveInitStatic = internal global [4 x i8] zeroinitializer, align 4
; CHECK: .data
-; CHECK-NEXT: .comm PrimitiveInitStatic, 4, 4
; CHECK-NEXT: .local PrimitiveInitStatic
+; CHECK-NEXT: .comm PrimitiveInitStatic, 4, 4
@PrimitiveUninit = internal global [4 x i8] zeroinitializer, align 4
; CHECK: .data
-; CHECK-NEXT: .comm PrimitiveUninit, 4, 4
; CHECK-NEXT: .local PrimitiveUninit
+; CHECK-NEXT: .comm PrimitiveUninit, 4, 4
@ArrayUninit = internal global [20 x i8] zeroinitializer, align 4
; CHECK: .data
-; CHECK-NEXT: .comm ArrayUninit, 20, 4
; CHECK-NEXT: .local ArrayUninit
+; CHECK-NEXT: .comm ArrayUninit, 20, 4
@ArrayUninitConstDouble = internal constant [200 x i8] zeroinitializer, align 8
; CHECK: .section .rodata,"a",@progbits
+; CHECK-NEXT: .local
; CHECK-NEXT: .align 8
; CHECK-NEXT: ArrayUninitConstDouble:
; CHECK-NEXT: .zero 200
@@ -58,6 +63,7 @@
@ArrayUninitConstInt = internal constant [20 x i8] zeroinitializer, align 4
; CHECK: .section .rodata,"a",@progbits
+; CHECK-NEXT: .local
; CHECK-NEXT: .align 4
; CHECK-NEXT: ArrayUninitConstInt:
; CHECK-NEXT: .zero 20
diff --git a/tests_lit/llvm2ice_tests/nacl-atomic-fence-all.ll b/tests_lit/llvm2ice_tests/nacl-atomic-fence-all.ll
index 595d30a..4b0127b 100644
--- a/tests_lit/llvm2ice_tests/nacl-atomic-fence-all.ll
+++ b/tests_lit/llvm2ice_tests/nacl-atomic-fence-all.ll
@@ -4,8 +4,8 @@
; applies to atomic load/stores).
;
; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s
-; RUIN: %llvm2ice -O2 --verbose none %s \
-; RUIN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj
+; RUN: %llvm2ice -O2 --verbose none %s \
+; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj
declare void @llvm.nacl.atomic.fence.all()
declare i32 @llvm.nacl.atomic.load.i32(i32*, i32)
diff --git a/tests_lit/llvm2ice_tests/shift.ll b/tests_lit/llvm2ice_tests/shift.ll
index 71f4adf..d9f608d 100644
--- a/tests_lit/llvm2ice_tests/shift.ll
+++ b/tests_lit/llvm2ice_tests/shift.ll
@@ -3,10 +3,10 @@
; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s
; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck %s
-; RUIN: %llvm2ice -O2 --verbose none %s \
-; RUIN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj
-; RUIN: %llvm2ice -Om1 --verbose none %s \
-; RUIN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj
+; RUN: %llvm2ice -O2 --verbose none %s \
+; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj
+; RUN: %llvm2ice -Om1 --verbose none %s \
+; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj
; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \