summaryrefslogtreecommitdiff
path: root/test/CodeGen/PowerPC
diff options
context:
space:
mode:
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>2014-06-16 21:36:02 +0000
committerBill Schmidt <wschmidt@linux.vnet.ibm.com>2014-06-16 21:36:02 +0000
commit212ec3a739dcc93206a81d582e9eca830589a107 (patch)
tree8816da4c32f2ba89955347ba9438282f145b312b /test/CodeGen/PowerPC
parente4f12201e3a827487b0aebb0ea6b773831dea4e9 (diff)
downloadllvm-212ec3a739dcc93206a81d582e9eca830589a107.tar.gz
llvm-212ec3a739dcc93206a81d582e9eca830589a107.tar.bz2
llvm-212ec3a739dcc93206a81d582e9eca830589a107.tar.xz
[PPC64] Fix PR19893 - improve code generation for local function addresses
Rafael opened http://llvm.org/bugs/show_bug.cgi?id=19893 to track non-optimal code generation for forming a function address that is local to the compile unit. The existing code was treating both local and non-local functions identically. This patch fixes the problem by properly identifying local functions and generating the proper addis/addi code. I also noticed that Rafael's earlier changes to correct the surrounding code in PPCISelLowering.cpp were also needed for fast instruction selection in PPCFastISel.cpp, so this patch fixes that code as well. The existing test/CodeGen/PowerPC/func-addr.ll is modified to test the new code generation. I've added a -O0 run line to test the fast-isel code as well. Tested on powerpc64[le]-unknown-linux-gnu with no regressions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211056 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/PowerPC')
-rw-r--r--test/CodeGen/PowerPC/func-addr.ll10
1 files changed, 3 insertions, 7 deletions
diff --git a/test/CodeGen/PowerPC/func-addr.ll b/test/CodeGen/PowerPC/func-addr.ll
index 0cce863992..4533c6258a 100644
--- a/test/CodeGen/PowerPC/func-addr.ll
+++ b/test/CodeGen/PowerPC/func-addr.ll
@@ -1,4 +1,5 @@
; RUN: llc -mtriple powerpc64-linux < %s | FileCheck %s
+; RUN: llc -O0 -mtriple powerpc64-linux < %s | FileCheck %s
define void @foo() {
ret void
@@ -6,15 +7,10 @@ define void @foo() {
declare i32 @bar(i8*)
; CHECK-LABEL: {{^}}zed:
-; CHECK: addis 3, 2, .LC1@toc@ha
-; CHECK-NEXT: ld 3, .LC1@toc@l(3)
+; CHECK: addis 3, 2, foo@toc@ha
+; CHECK-NEXT: addi 3, 3, foo@toc@l
; 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