Skip to content

Commit 4aaf43b

Browse files
committed
fix a machine instrunction verify error
1 parent b73c8db commit 4aaf43b

File tree

2 files changed

+32
-6
lines changed

2 files changed

+32
-6
lines changed

llvm/lib/Target/PowerPC/PPCISelLowering.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8022,6 +8022,12 @@ SDValue PPCTargetLowering::LowerCall_AIX(
80228022
InGlue = Chain.getValue(1);
80238023
}
80248024

8025+
if (CFlags.IsTailCall && !IsSibCall) {
8026+
// Emit callseq_end just before tailcall node.
8027+
Chain = DAG.getCALLSEQ_END(Chain, NumBytes, 0, InGlue, dl);
8028+
InGlue = Chain.getValue(1);
8029+
}
8030+
80258031
const int SPDiff = 0;
80268032
return FinishCall(CFlags, dl, DAG, RegsToPass, InGlue, Chain, CallSeqStart,
80278033
Callee, SPDiff, NumBytes, Ins, InVals, CB);

llvm/test/CodeGen/PowerPC/ppc64-sibcall-shrinkwrap.ll

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22
; RUN: llc -relocation-model=static -verify-machineinstrs < %s -mtriple=powerpc64-unknown-linux-gnu -disable-ppc-sco=false --enable-shrink-wrap=true | FileCheck %s -check-prefix=CHECK-SCO-SR
33
; RUN: llc -relocation-model=static -verify-machineinstrs < %s -mtriple=powerpc64le-unknown-linux-gnu -disable-ppc-sco=false --enable-shrink-wrap=false | FileCheck %s -check-prefix=CHECK-SCO-ONLY
44
; RUN: llc -relocation-model=static -verify-machineinstrs < %s -mtriple=powerpc64le-unknown-linux-gnu -disable-ppc-sco=false --enable-shrink-wrap=true | FileCheck %s -check-prefix=CHECK-SCO-SR
5-
; RUN: not --crash llc -relocation-model=pic -verify-machineinstrs < %s -mtriple=powerpc64-ibm-aix-xcoff -tailcallopt -disable-ppc-sco=false --enable-shrink-wrap=true 2>&1 | FileCheck %s -check-prefix=CHECK-AIX
6-
;; The above RUN command is expected to fail on AIX since calling is not implemented ATM
5+
6+
7+
; RUN: llc -relocation-model=pic -verify-machineinstrs < %s -mtriple=powerpc64-ibm-aix-xcoff -disable-ppc-sco=false --enable-shrink-wrap=false | FileCheck %s -check-prefixes=CHECK-SCO-ONLY-AIX,CHECK-SCO-ONLY-AIX64
8+
; RUN: llc -relocation-model=pic -verify-machineinstrs < %s -mtriple=powerpc-ibm-aix-xcoff -disable-ppc-sco=false --enable-shrink-wrap=false | FileCheck %s -check-prefixes=CHECK-SCO-ONLY-AIX,CHECK-SCO-ONLY-AIX32
9+
; RUN: llc -relocation-model=pic -verify-machineinstrs < %s -mtriple=powerpc64-ibm-aix-xcoff -disable-ppc-sco=false --enable-shrink-wrap=true | FileCheck %s -check-prefixes=CHECK-SCO-SR-AIX64,CHECK-SCO-SR-AIX
10+
; RUN: llc -relocation-model=pic -verify-machineinstrs < %s -mtriple=powerpc-ibm-aix-xcoff -disable-ppc-sco=false --enable-shrink-wrap=true | FileCheck %s -check-prefixes=CHECK-SCO-SR-AIX32,CHECK-SCO-SR-AIX
11+
712
%"class.clang::NamedDecl" = type { i32 }
813
declare void @__assert_fail();
914

@@ -14,12 +19,12 @@ entry:
1419
br i1 %tobool, label %cond.false, label %exit
1520

1621
cond.false:
17-
call void @__assert_fail()
22+
tail call void @__assert_fail()
1823
unreachable
1924

2025
exit:
2126
%bf.load = load i32, ptr %this, align 4
22-
%call.i = call i8 @LVComputationKind(
27+
%call.i = tail call i8 @LVComputationKind(
2328
ptr %this,
2429
i32 %bf.load)
2530
ret i8 %call.i
@@ -29,14 +34,29 @@ exit:
2934
; CHECK-SCO-ONLY: b LVComputationKind
3035
; CHECK-SCO-ONLY: #TC_RETURNd8
3136
; CHECK-SCO-ONLY: bl __assert_fail
32-
;
37+
38+
; CHECK-SCO-ONLY-AIXLABEL: _ZNK5clang9NamedDecl23getLinkageAndVisibilityEv:
39+
; CHECK-SCO-ONLY-AIX64: stdu 1, -{{[0-9]+}}(1)
40+
; CHECK-SCO-ONLY-AIX32: stwu 1, -{{[0-9]+}}(1)
41+
; CHECK-SCO-ONLY-AIX: b .LVComputationKind
42+
; CHECK-SCO-ONLY-AiX64: #TC_RETURNd8
43+
; CHECK-SCO-ONLY-AiX32: #TC_RETURNd
44+
; CHECK-SCO-ONLY-AIX: bl .__assert_fail
45+
3346
; CHECK-SCO-SR-LABEL: _ZNK5clang9NamedDecl23getLinkageAndVisibilityEv:
3447
; CHECK-SCO-SR: b LVComputationKind
3548
; CHECK-SCO-SR: #TC_RETURNd8
3649
; CHECK-SCO-SR: stdu 1, -{{[0-9]+}}(1)
3750
; CHECK-SCO-SR: bl __assert_fail
3851

39-
; CHECK-AIX: LLVM ERROR: Tail call support for non-fastcc calling convention is unimplemented on AIX.
52+
; CHECK-SCO-SR-AIX-LABEL: _ZNK5clang9NamedDecl23getLinkageAndVisibilityEv:
53+
; CHECK-SCO-SR-AIX: b .LVComputationKind
54+
; CHECK-SCO-SR-AIX64: #TC_RETURNd8
55+
; CHECK-SCO-SR-AIX64: stdu 1, -{{[0-9]+}}(1)
56+
; CHECK-SCO-SR-AIX32: #TC_RETURNd
57+
; CHECK-SCO-SR-AIX32: stwu 1, -{{[0-9]+}}(1)
58+
; CHECK-SCO-SR-AIX: bl .__assert_fail
59+
4060
}
4161

4262
define dso_local fastcc i8 @LVComputationKind(

0 commit comments

Comments
 (0)