summaryrefslogtreecommitdiffstats
path: root/llvm/test/Bitcode/function-address-space-fwd-decl.ll
diff options
context:
space:
mode:
authorAlexander Richardson <arichardson.kde@gmail.com>2018-08-23 09:25:17 +0000
committerAlexander Richardson <arichardson.kde@gmail.com>2018-08-23 09:25:17 +0000
commit6bcf2ba2f0fff179602fd60b5e0127cd20fc907e (patch)
treee75d5473ea23982ba49e0c6ee1b24fd35b57dd8f /llvm/test/Bitcode/function-address-space-fwd-decl.ll
parentba9eee5fadf1114d5ed422ce80dca50099057933 (diff)
downloadbcm5719-llvm-6bcf2ba2f0fff179602fd60b5e0127cd20fc907e.tar.gz
bcm5719-llvm-6bcf2ba2f0fff179602fd60b5e0127cd20fc907e.zip
Allow creating llvm::Function in non-zero address spaces
Most users won't have to worry about this as all of the 'getOrInsertFunction' functions on Module will default to the program address space. An overload has been added to Function::Create to abstract away the details for most callers. This is based on https://reviews.llvm.org/D37054 but without the changes to make passing a Module to Function::Create() mandatory. I have also added some more tests and fixed the LLParser to accept call instructions for types in the program address space. Reviewed By: bjope Differential Revision: https://reviews.llvm.org/D47541 llvm-svn: 340519
Diffstat (limited to 'llvm/test/Bitcode/function-address-space-fwd-decl.ll')
-rw-r--r--llvm/test/Bitcode/function-address-space-fwd-decl.ll39
1 files changed, 39 insertions, 0 deletions
diff --git a/llvm/test/Bitcode/function-address-space-fwd-decl.ll b/llvm/test/Bitcode/function-address-space-fwd-decl.ll
new file mode 100644
index 00000000000..f10c2287e4b
--- /dev/null
+++ b/llvm/test/Bitcode/function-address-space-fwd-decl.ll
@@ -0,0 +1,39 @@
+; Verify that forward declarations from call instructions work even with non-zero AS
+; RUN: llvm-as %s -o - | llvm-dis - | FileCheck %s
+
+define void @call_named() {
+entry:
+ %0 = tail call addrspace(40) i32 @named(i16* null)
+ ; CHECK: %0 = tail call addrspace(40) i32 @named(i16* null)
+ ret void
+}
+
+define void @call_numbered() {
+entry:
+ %0 = tail call addrspace(40) i32 @0(i16* null)
+ ; CHECK: %0 = tail call addrspace(40) i32 @0(i16* null)
+ ret void
+}
+
+
+define i32 @invoked() personality i8* null {
+entry:
+ %0 = invoke addrspace(40) i32 @foo() to label %l1 unwind label %lpad
+ ; CHECK: invoke addrspace(40) i32 @foo()
+l1:
+ br label %return
+lpad:
+ %1 = landingpad { i8*, i32 }
+ catch i8* null
+ catch i8* null
+ ret i32 0
+return:
+ ret i32 0
+}
+
+declare i32 @foo() addrspace(40)
+; CHECK: declare i32 @foo() addrspace(40)
+declare i32 @named(i16* nocapture) addrspace(40)
+; CHECK: declare i32 @named(i16* nocapture) addrspace(40)
+declare i32 @0(i16*) addrspace(40)
+; CHECK: declare i32 @0(i16*) addrspace(40)
OpenPOWER on IntegriCloud