[PATCH] D102004: [GlobalISel] Fix wrong invocation of `getParamStackAlign` (NFC)
Momchil Velikov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 10 04:17:47 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf3139b20a0bf: [GlobalISel] Fix wrong invocation of `getParamStackAlign` (NFC) (authored by chill).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102004/new/
https://reviews.llvm.org/D102004
Files:
llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
Index: llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
===================================================================
--- llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
+++ llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
@@ -154,8 +154,9 @@
const AttributeList &Attrs = FuncInfo.getAttributes();
addArgFlagsFromAttributes(Flags, Attrs, OpIdx);
- Align MemAlign;
+ Align MemAlign = DL.getABITypeAlign(Arg.Ty);
if (Flags.isByVal() || Flags.isInAlloca() || Flags.isPreallocated()) {
+ assert(OpIdx >= AttributeList::FirstArgIndex);
Type *ElementTy = cast<PointerType>(Arg.Ty)->getElementType();
auto Ty = Attrs.getAttribute(OpIdx, Attribute::ByVal).getValueAsType();
@@ -163,16 +164,18 @@
// For ByVal, alignment should be passed from FE. BE will guess if
// this info is not there but there are cases it cannot get right.
- if (auto ParamAlign = FuncInfo.getParamStackAlign(OpIdx - 1))
+ if (auto ParamAlign =
+ FuncInfo.getParamStackAlign(OpIdx - AttributeList::FirstArgIndex))
MemAlign = *ParamAlign;
- else if ((ParamAlign = FuncInfo.getParamAlign(OpIdx - 1)))
+ else if ((ParamAlign =
+ FuncInfo.getParamAlign(OpIdx - AttributeList::FirstArgIndex)))
MemAlign = *ParamAlign;
else
MemAlign = Align(getTLI()->getByValTypeAlignment(ElementTy, DL));
- } else if (auto ParamAlign = FuncInfo.getParamStackAlign(OpIdx - 1)) {
- MemAlign = *ParamAlign;
- } else {
- MemAlign = Align(DL.getABITypeAlign(Arg.Ty));
+ } else if (OpIdx >= AttributeList::FirstArgIndex) {
+ if (auto ParamAlign =
+ FuncInfo.getParamStackAlign(OpIdx - AttributeList::FirstArgIndex))
+ MemAlign = *ParamAlign;
}
Flags.setMemAlign(MemAlign);
Flags.setOrigAlign(DL.getABITypeAlign(Arg.Ty));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102004.344019.patch
Type: text/x-patch
Size: 1798 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210510/d2125e69/attachment.bin>
More information about the llvm-commits
mailing list