From 1613650e90428d4f178913e067468643c3fba925 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 29 May 2014 15:13:23 +0000 Subject: [PATCH] Add a test showing the ppc code sequence for getting a function pointer. This would have found the miscompile in r209638. llvm-svn: 209820 --- llvm/test/CodeGen/PowerPC/func-addr.ll | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 llvm/test/CodeGen/PowerPC/func-addr.ll diff --git a/llvm/test/CodeGen/PowerPC/func-addr.ll b/llvm/test/CodeGen/PowerPC/func-addr.ll new file mode 100644 index 0000000..0cce863 --- /dev/null +++ b/llvm/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 +} -- 2.7.4