[llvm] 56e41fc - [PowerPC] Bail out of FISel when lowering long calls
Nemanja Ivanovic via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 16 13:15:42 PST 2023
Author: Nemanja Ivanovic
Date: 2023-02-16T16:15:32-05:00
New Revision: 56e41fcf50283f9a76aa65eaf76f118db3bfd1ba
URL: https://github.com/llvm/llvm-project/commit/56e41fcf50283f9a76aa65eaf76f118db3bfd1ba
DIFF: https://github.com/llvm/llvm-project/commit/56e41fcf50283f9a76aa65eaf76f118db3bfd1ba.diff
LOG: [PowerPC] Bail out of FISel when lowering long calls
We currently don't handle tail calls in fast-isel but
we continue with the lowering when -mlongcall is
specified and lower the calls normally. We should
defer to SDISel for this so that it is lowered correctly.
Differential revision: https://reviews.llvm.org/D123997
Added:
Modified:
llvm/lib/Target/PowerPC/PPCFastISel.cpp
llvm/test/CodeGen/PowerPC/longcall.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/PowerPC/PPCFastISel.cpp b/llvm/lib/Target/PowerPC/PPCFastISel.cpp
index 329a81970f64b..a34a3902edb00 100644
--- a/llvm/lib/Target/PowerPC/PPCFastISel.cpp
+++ b/llvm/lib/Target/PowerPC/PPCFastISel.cpp
@@ -1555,8 +1555,8 @@ bool PPCFastISel::fastLowerCall(CallLoweringInfo &CLI) {
if (!Callee && !Symbol)
return false;
- // Allow SelectionDAG isel to handle tail calls.
- if (IsTailCall)
+ // Allow SelectionDAG isel to handle tail calls and long calls.
+ if (IsTailCall || Subtarget->useLongCalls())
return false;
// Let SDISel handle vararg functions.
diff --git a/llvm/test/CodeGen/PowerPC/longcall.ll b/llvm/test/CodeGen/PowerPC/longcall.ll
index 9645ca8d31f3c..c476f608ec723 100644
--- a/llvm/test/CodeGen/PowerPC/longcall.ll
+++ b/llvm/test/CodeGen/PowerPC/longcall.ll
@@ -1,14 +1,29 @@
; RUN: llc < %s | FileCheck %s
+; RUN: llc --fast-isel < %s | FileCheck %s
target datalayout = "E-m:e-i64:64-n32:64"
target triple = "powerpc64-unknown-linux-gnu"
; Function Attrs: nounwind
-define void @bar() local_unnamed_addr #0 {
+define void @tail() local_unnamed_addr #0 {
entry:
tail call void @foo() #1
ret void
-; CHECK-LABEL: @bar
+; CHECK-LABEL: @tail
+; CHECK: ld [[FD:[0-9]+]], .LC0 at toc@l({{[0-9]+}})
+; CHECK: ld [[ADDR:[0-9]+]], 0([[FD]])
+; CHECK: mtctr [[ADDR]]
+; CHECK: bctrl
+; CHECK-NOT: bl foo
+; CHECK: blr
+}
+
+define void @notail() local_unnamed_addr #0 {
+entry:
+ call void @foo() #1
+ ret void
+
+; CHECK-LABEL: @notail
; CHECK: ld [[FD:[0-9]+]], .LC0 at toc@l({{[0-9]+}})
; CHECK: ld [[ADDR:[0-9]+]], 0([[FD]])
; CHECK: mtctr [[ADDR]]
More information about the llvm-commits
mailing list