summaryrefslogtreecommitdiffstats
path: root/llvm/test/Assembler
diff options
context:
space:
mode:
authorAlexander Richardson <arichardson.kde@gmail.com>2018-02-27 11:15:11 +0000
committerAlexander Richardson <arichardson.kde@gmail.com>2018-02-27 11:15:11 +0000
commitc11ae185aa417bf261af83f0bbe6cea14a8e9c01 (patch)
treecae8a701289acfe060ae1795532dc2ad6f49d40b /llvm/test/Assembler
parent53713c0e1aee218fbad02827cc3ad3c598ef157e (diff)
downloadbcm5719-llvm-c11ae185aa417bf261af83f0bbe6cea14a8e9c01.tar.gz
bcm5719-llvm-c11ae185aa417bf261af83f0bbe6cea14a8e9c01.zip
Make the LLParser accept call instructions of variables in the program AS
Summary: Since r325479 the DataLayout includes a program address space. However, it is not possible to use `call %foo` if foo is a `i8(...) addrspace(200)` and the DataLayout specifies address space 200 as the address space for functions. With this change the IR parser will still accept variables in the program address space as well as address space 0 for call and invoke functions. Reviewers: pcc, arsenm, bjope, dylanmckay, theraven Reviewed By: dylanmckay Subscribers: wdng, llvm-commits Differential Revision: https://reviews.llvm.org/D43645 llvm-svn: 326188
Diffstat (limited to 'llvm/test/Assembler')
-rw-r--r--llvm/test/Assembler/call-nonzero-program-addrspace-2.ll11
-rw-r--r--llvm/test/Assembler/call-nonzero-program-addrspace.ll13
-rw-r--r--llvm/test/Assembler/invoke-nonzero-program-addrspace.ll18
3 files changed, 42 insertions, 0 deletions
diff --git a/llvm/test/Assembler/call-nonzero-program-addrspace-2.ll b/llvm/test/Assembler/call-nonzero-program-addrspace-2.ll
new file mode 100644
index 00000000000..ed8546c61c8
--- /dev/null
+++ b/llvm/test/Assembler/call-nonzero-program-addrspace-2.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as %s -data-layout=P200 -o /dev/null
+; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
+
+; Check that numbered variables in a nonzero program address space 200 can be used in a call instruction
+
+define i8 @test_unnamed(i8(i32)*, i8(i32) addrspace(200)*) {
+ %first = call i8 %0(i32 0) ; this is fine
+ %second = call i8 %1(i32 0) ; this is also fine if it's the program AS
+ ; CHECK: call-nonzero-program-addrspace-2.ll:[[@LINE-1]]:21: error: '%1' defined with type 'i8 (i32) addrspace(200)*'
+ ret i8 0
+}
diff --git a/llvm/test/Assembler/call-nonzero-program-addrspace.ll b/llvm/test/Assembler/call-nonzero-program-addrspace.ll
new file mode 100644
index 00000000000..1d1a224212d
--- /dev/null
+++ b/llvm/test/Assembler/call-nonzero-program-addrspace.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as %s -data-layout=P200 -o /dev/null
+; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
+
+; Check that variables in a nonzero program address space 200 can be used in a call instruction
+
+define i8 @test(i8(i32)* %fnptr0, i8(i32) addrspace(200)* %fnptr200) {
+ %first = call i8 %fnptr0(i32 0) ; this is fine
+ %second = call i8 %fnptr200(i32 0) ; this is also fine if it's the program AS
+ ; CHECK: call-nonzero-program-addrspace.ll:[[@LINE-1]]:21: error: '%fnptr200' defined with type 'i8 (i32) addrspace(200)*'
+ ret i8 0
+}
+
+declare i32 @__gxx_personality_v0(...)
diff --git a/llvm/test/Assembler/invoke-nonzero-program-addrspace.ll b/llvm/test/Assembler/invoke-nonzero-program-addrspace.ll
new file mode 100644
index 00000000000..443884590d6
--- /dev/null
+++ b/llvm/test/Assembler/invoke-nonzero-program-addrspace.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as %s -data-layout=P200 -o /dev/null
+; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
+
+; Check that variables in a nonzero program address space 200 can be used in a invoke instruction
+
+define i8 @test_invoke(i8(i32)* %fnptr0, i8(i32) addrspace(200)* %fnptr200) personality i32 (...)* @__gxx_personality_v0 {
+ %first = invoke i8 %fnptr0(i32 0) to label %ok unwind label %lpad ; this is fine
+ %second = invoke i8 %fnptr200(i32 0) to label %ok unwind label %lpad ; this is also fine if it's the program AS
+ ; CHECK: invoke-nonzero-program-addrspace.ll:[[@LINE-1]]:23: error: '%fnptr200' defined with type 'i8 (i32) addrspace(200)*'
+ok:
+ ret i8 0
+lpad:
+ %exn = landingpad {i8*, i32}
+ cleanup
+ unreachable
+}
+
+declare i32 @__gxx_personality_v0(...)
OpenPOWER on IntegriCloud