Skip to content

Commit ef13b0e

Browse files
committed
riscv: update 'failed to perform tail call elimination' example
It is kind of trivial now, because musttail is accepted for more signatures
1 parent cab416d commit ef13b0e

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23900,7 +23900,7 @@ SDValue RISCVTargetLowering::LowerCall(CallLoweringInfo &CLI,
2390023900
StackPtr = DAG.getCopyFromReg(Chain, DL, RISCV::X2, PtrVT);
2390123901

2390223902
if (IsTailCall) {
23903-
unsigned OpSize = (VA.getValVT().getSizeInBits() + 7) / 8;
23903+
unsigned OpSize = divideCeil(VA.getValVT().getSizeInBits(), 8);
2390423904
int FI = MF.getFrameInfo().CreateFixedObject(OpSize, Offset, true);
2390523905
DstAddr = DAG.getFrameIndex(FI, PtrVT);
2390623906
DstInfo = MachinePointerInfo::getFixedStack(MF, FI);

llvm/test/CodeGen/RISCV/musttail-call.ll

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
99
; RUN: not --crash llc -mtriple riscv64-unknown-elf -o - %s \
1010
; RUN: 2>&1 | FileCheck %s
1111

12-
%struct.A = type { i32 }
12+
declare void @callee_musttail()
1313

14-
declare void @callee_musttail(ptr sret(%struct.A) %a)
15-
define void @caller_musttail(ptr sret(%struct.A) %a) {
14+
define void @caller_musttail() #0 {
1615
; CHECK: LLVM ERROR: failed to perform tail call elimination on a call site marked musttail
1716
entry:
18-
musttail call void @callee_musttail(ptr sret(%struct.A) %a)
17+
musttail call void @callee_musttail()
1918
ret void
2019
}
20+
21+
attributes #0 = { "interrupt"="machine" }

0 commit comments

Comments
 (0)