Skip to content

Commit

Permalink
[AArch64][Windows] Check sret attribute also for inreg attribute
Browse files Browse the repository at this point in the history
Fix the issue: #57684

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D135512
  • Loading branch information
bcl5980 committed Oct 12, 2022
1 parent 2749b94 commit 41f5bbe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6313,7 +6313,7 @@ SDValue AArch64TargetLowering::LowerFormalArguments(
// epilogue.
if (IsWin64) {
for (unsigned I = 0, E = Ins.size(); I != E; ++I) {
if (Ins[I].Flags.isInReg()) {
if (Ins[I].Flags.isInReg() && Ins[I].Flags.isSRet()) {
assert(!FuncInfo->getSRetReturnReg());

MVT PtrTy = getPointerTy(DAG.getDataLayout());
Expand Down
12 changes: 12 additions & 0 deletions llvm/test/CodeGen/AArch64/arm64-windows-calls.ll
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,15 @@ define void @call_copy_notpod() {
; CHECK: bl copy_notpod
; CHECK-NEXT: stp x0, x1, [{{.*}}]
}

; We shouldn't return the argument
; when it has only inreg attribute
define i64 @foobar(i64* inreg %0) {
; CHECK-LABEL: foobar:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: ldr x0, [x0]
; CHECK-NEXT: ret
entry:
%1 = load i64, i64* %0
ret i64 %1
}

0 comments on commit 41f5bbe

Please sign in to comment.