[PATCH] D83175: [X86] Fix a bug that when lowering byval argument
LiuChen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 7 07:00:44 PDT 2020
This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rGea85ff82c826: [X86] Fix a bug that when lowering byval argument (authored by LiuChen3).
Changed prior to commit:
https://reviews.llvm.org/D83175?vs=275547&id=275662#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83175/new/
https://reviews.llvm.org/D83175
Files:
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Target/X86/X86ISelLowering.h
llvm/test/CodeGen/X86/win64-byval.ll
Index: llvm/test/CodeGen/X86/win64-byval.ll
===================================================================
--- llvm/test/CodeGen/X86/win64-byval.ll
+++ llvm/test/CodeGen/X86/win64-byval.ll
@@ -32,3 +32,31 @@
call void @foo({ float, double }* byval %arg)
ret void
}
+
+declare void @foo2({ float, double }* byval, { float, double }* byval, { float, double }* byval, { float, double }* byval, { float, double }* byval, i64 %f)
+ at data = external constant { float, double }
+
+define void @test() {
+; CHECK-LABEL: @test
+; CHECK: movq (%rax), %rcx
+; CHECK-NEXT: movq 8(%rax), %rax
+; CHECK-NEXT: movq %rax, 120(%rsp)
+; CHECK-NEXT: movq %rcx, 112(%rsp)
+; CHECK-NEXT: movq %rcx, 96(%rsp)
+; CHECK-NEXT: movq %rax, 104(%rsp)
+; CHECK-NEXT: movq %rcx, 80(%rsp)
+; CHECK-NEXT: movq %rax, 88(%rsp)
+; CHECK-NEXT: movq %rcx, 64(%rsp)
+; CHECK-NEXT: movq %rax, 72(%rsp)
+; CHECK-NEXT: movq %rax, 56(%rsp)
+; CHECK-NEXT: movq %rcx, 48(%rsp)
+; CHECK-NEXT: leaq 48(%rsp), %rax
+; CHECK-NEXT: movq %rax, 32(%rsp)
+; CHECK-NEXT: movq $10, 40(%rsp)
+; CHECK-NEXT: leaq 112(%rsp), %rcx
+; CHECK-NEXT: leaq 96(%rsp), %rdx
+; CHECK-NEXT: leaq 80(%rsp), %r8
+; CHECK-NEXT: leaq 64(%rsp), %r9
+ call void @foo2({ float, double }* byval @G, { float, double }* byval @G, { float, double }* byval @G, { float, double }* byval @G, { float, double }* byval @G, i64 10)
+ ret void
+}
Index: llvm/lib/Target/X86/X86ISelLowering.h
===================================================================
--- llvm/lib/Target/X86/X86ISelLowering.h
+++ llvm/lib/Target/X86/X86ISelLowering.h
@@ -1436,7 +1436,7 @@
SDValue LowerMemOpCallTo(SDValue Chain, SDValue StackPtr, SDValue Arg,
const SDLoc &dl, SelectionDAG &DAG,
const CCValAssign &VA,
- ISD::ArgFlagsTy Flags) const;
+ ISD::ArgFlagsTy Flags, bool isByval) const;
// Call lowering helpers.
Index: llvm/lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- llvm/lib/Target/X86/X86ISelLowering.cpp
+++ llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -3763,12 +3763,13 @@
SDValue Arg, const SDLoc &dl,
SelectionDAG &DAG,
const CCValAssign &VA,
- ISD::ArgFlagsTy Flags) const {
+ ISD::ArgFlagsTy Flags,
+ bool isByVal) const {
unsigned LocMemOffset = VA.getLocMemOffset();
SDValue PtrOff = DAG.getIntPtrConstant(LocMemOffset, dl);
PtrOff = DAG.getNode(ISD::ADD, dl, getPointerTy(DAG.getDataLayout()),
StackPtr, PtrOff);
- if (Flags.isByVal())
+ if (isByVal)
return CreateCopyOfByValArgument(Arg, PtrOff, Chain, Flags, DAG, dl);
return DAG.getStore(
@@ -4080,7 +4081,7 @@
StackPtr = DAG.getCopyFromReg(Chain, dl, RegInfo->getStackRegister(),
getPointerTy(DAG.getDataLayout()));
MemOpChains.push_back(LowerMemOpCallTo(Chain, StackPtr, Arg,
- dl, DAG, VA, Flags));
+ dl, DAG, VA, Flags, isByVal));
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83175.275662.patch
Type: text/x-patch
Size: 3438 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200707/6d90c723/attachment.bin>
More information about the llvm-commits
mailing list