summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-05-29 15:13:23 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-05-29 15:13:23 +0000
commitf5df18bff0f888d4772ad80d137d2d591bb99b5e (patch)
tree8b4e6894c0cc328d14f641a45f8dff98721adb8c /test
parent843ac4747a6e02884a93e04a5463de340d044a0f (diff)
downloadllvm-f5df18bff0f888d4772ad80d137d2d591bb99b5e.tar.gz
llvm-f5df18bff0f888d4772ad80d137d2d591bb99b5e.tar.bz2
llvm-f5df18bff0f888d4772ad80d137d2d591bb99b5e.tar.xz
Add a test showing the ppc code sequence for getting a function pointer.
This would have found the miscompile in r209638. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209820 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/PowerPC/func-addr.ll21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/CodeGen/PowerPC/func-addr.ll b/test/CodeGen/PowerPC/func-addr.ll
new file mode 100644
index 0000000000..0cce863992
--- /dev/null
+++ b/test/CodeGen/PowerPC/func-addr.ll
@@ -0,0 +1,21 @@
+; RUN: llc -mtriple powerpc64-linux < %s | FileCheck %s
+
+define void @foo() {
+ ret void
+}
+declare i32 @bar(i8*)
+
+; CHECK-LABEL: {{^}}zed:
+; CHECK: addis 3, 2, .LC1@toc@ha
+; CHECK-NEXT: ld 3, .LC1@toc@l(3)
+; CHECK-NEXT: bl bar
+
+
+; CHECK-LABEL: .section .toc,"aw",@progbits
+; CHECK: .LC1:
+; CHECK-NEXT: .tc foo[TC],foo
+
+define void @zed() {
+ call i32 @bar(i8* bitcast (void ()* @foo to i8*))
+ ret void
+}