summaryrefslogtreecommitdiff
path: root/test/Assembler
diff options
context:
space:
mode:
authorYaxun Liu <Yaxun.Liu@amd.com>2018-01-30 22:32:39 +0000
committerYaxun Liu <Yaxun.Liu@amd.com>2018-01-30 22:32:39 +0000
commit7c2d049c5b324e9af37f1c4f42118de8fc4c638b (patch)
treee45dd0cbf65ff03ac7af32db699ffc87fdd22ca1 /test/Assembler
parentdb459e238aedcafdcca5746c0ba11a515eb333dd (diff)
LLParser: add an argument for overriding data layout and do not check alloca addr space
Sometimes users do not specify data layout in LLVM assembly and let llc set the data layout by target triple after loading the LLVM assembly. Currently the parser checks alloca address space no matter whether the LLVM assembly contains data layout definition, which causes false alarm since the default data layout does not contain the correct alloca address space. The parser also calls verifier to check debug info and updating invalid debug info. Currently there is no way to let the verifier to check debug info only. If the verifier finds non-debug-info issues the parser will fail. For llc, the fix is to remove the check of alloca addr space in the parser and disable updating debug info, and defer the updating of debug info and verification to be after setting data layout of the IR by target. For other llvm tools, since they do not override data layout by target but instead can override data layout by a command line option, an argument for overriding data layout is added to the parser. In cases where data layout overriding is necessary for the parser, the data layout can be provided by command line. Differential Revision: https://reviews.llvm.org/D41832 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323826 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Assembler')
-rw-r--r--test/Assembler/datalayout-alloca-addrspace-mismatch-0.ll4
-rw-r--r--test/Assembler/datalayout-alloca-addrspace-mismatch-1.ll4
-rw-r--r--test/Assembler/datalayout-alloca-addrspace-mismatch-2.ll4
-rw-r--r--test/Assembler/drop-debug-info-nonzero-alloca.ll25
4 files changed, 34 insertions, 3 deletions
diff --git a/test/Assembler/datalayout-alloca-addrspace-mismatch-0.ll b/test/Assembler/datalayout-alloca-addrspace-mismatch-0.ll
index 31920183c65..828aa133c76 100644
--- a/test/Assembler/datalayout-alloca-addrspace-mismatch-0.ll
+++ b/test/Assembler/datalayout-alloca-addrspace-mismatch-0.ll
@@ -2,7 +2,9 @@
target datalayout = "A1"
-; CHECK: :7:41: error: address space must match datalayout
+; CHECK: Allocation instruction pointer not in the stack address space!
+; CHECK-NEXT: %alloca_scalar_no_align = alloca i32, addrspace(2)
+
define void @use_alloca() {
%alloca_scalar_no_align = alloca i32, addrspace(2)
ret void
diff --git a/test/Assembler/datalayout-alloca-addrspace-mismatch-1.ll b/test/Assembler/datalayout-alloca-addrspace-mismatch-1.ll
index 8778a05291c..9f1b91aae61 100644
--- a/test/Assembler/datalayout-alloca-addrspace-mismatch-1.ll
+++ b/test/Assembler/datalayout-alloca-addrspace-mismatch-1.ll
@@ -2,7 +2,9 @@
target datalayout = "A1"
-; CHECK: :7:50: error: address space must match datalayout
+; CHECK: Allocation instruction pointer not in the stack address space!
+; CHECK-NEXT: %alloca_scalar_no_align = alloca i32, align 4, addrspace(2)
+
define void @use_alloca() {
%alloca_scalar_no_align = alloca i32, align 4, addrspace(2)
ret void
diff --git a/test/Assembler/datalayout-alloca-addrspace-mismatch-2.ll b/test/Assembler/datalayout-alloca-addrspace-mismatch-2.ll
index b6e2738a4f6..1e9d3cb959c 100644
--- a/test/Assembler/datalayout-alloca-addrspace-mismatch-2.ll
+++ b/test/Assembler/datalayout-alloca-addrspace-mismatch-2.ll
@@ -2,7 +2,9 @@
target datalayout = "A1"
-; CHECK: :7:50: error: address space must match datalayout
+; CHECK: Allocation instruction pointer not in the stack address space!
+; CHECK-NEXT: %alloca_scalar_no_align = alloca i32, align 4, addrspace(2), !foo !0
+
define void @use_alloca() {
%alloca_scalar_no_align = alloca i32, align 4, addrspace(2), !foo !0
ret void
diff --git a/test/Assembler/drop-debug-info-nonzero-alloca.ll b/test/Assembler/drop-debug-info-nonzero-alloca.ll
new file mode 100644
index 00000000000..739edbacde9
--- /dev/null
+++ b/test/Assembler/drop-debug-info-nonzero-alloca.ll
@@ -0,0 +1,25 @@
+; RUN: llvm-as < %s -o %t.bc -data-layout=A5 2>&1 | FileCheck -check-prefixes=COM,AS %s
+; RUN: llvm-dis < %t.bc | FileCheck -check-prefixes=COM,DIS %s
+; RUN: opt < %s -S -data-layout=A5 2>&1 | FileCheck -check-prefixes=COM,AS %s
+; RUN: opt < %t.bc -S | FileCheck -check-prefixes=COM,DIS %s
+
+define void @foo() {
+entry:
+; DIS: target datalayout = "A5"
+; DIS: %tmp = alloca i32, addrspace(5)
+ %tmp = alloca i32, addrspace(5)
+ call void @llvm.dbg.value(
+ metadata i8* undef,
+ metadata !DILocalVariable(scope: !1),
+ metadata !DIExpression())
+; COM-NOT: Allocation instruction pointer not in the stack address space!
+; AS: llvm.dbg.value intrinsic requires a !dbg attachment
+; AS: warning: ignoring invalid debug info in <stdin>
+ret void
+}
+
+declare void @llvm.dbg.value(metadata, metadata, metadata)
+
+!llvm.module.flags = !{!0}
+!0 = !{i32 2, !"Debug Info Version", i32 3}
+!1 = distinct !DISubprogram(name: "foo")