Skip to content

Commit 41f5bbe

Browse files
committed
[AArch64][Windows] Check sret attribute also for inreg attribute
Fix the issue: #57684 Reviewed By: efriedma Differential Revision: https://reviews.llvm.org/D135512
1 parent 2749b94 commit 41f5bbe

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6313,7 +6313,7 @@ SDValue AArch64TargetLowering::LowerFormalArguments(
63136313
// epilogue.
63146314
if (IsWin64) {
63156315
for (unsigned I = 0, E = Ins.size(); I != E; ++I) {
6316-
if (Ins[I].Flags.isInReg()) {
6316+
if (Ins[I].Flags.isInReg() && Ins[I].Flags.isSRet()) {
63176317
assert(!FuncInfo->getSRetReturnReg());
63186318

63196319
MVT PtrTy = getPointerTy(DAG.getDataLayout());

llvm/test/CodeGen/AArch64/arm64-windows-calls.ll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,15 @@ define void @call_copy_notpod() {
176176
; CHECK: bl copy_notpod
177177
; CHECK-NEXT: stp x0, x1, [{{.*}}]
178178
}
179+
180+
; We shouldn't return the argument
181+
; when it has only inreg attribute
182+
define i64 @foobar(i64* inreg %0) {
183+
; CHECK-LABEL: foobar:
184+
; CHECK: // %bb.0: // %entry
185+
; CHECK-NEXT: ldr x0, [x0]
186+
; CHECK-NEXT: ret
187+
entry:
188+
%1 = load i64, i64* %0
189+
ret i64 %1
190+
}

0 commit comments

Comments
 (0)