diff options
author | Arthur Eubanks <aeubanks@google.com> | 2021-05-01 21:27:47 -0700 |
---|---|---|
committer | Arthur Eubanks <aeubanks@google.com> | 2021-05-18 14:30:22 -0700 |
commit | bc7d15c61da78864b35e3c114294d6e4db645611 (patch) | |
tree | d6d0403adcbf0245bb8d9ede4a7f3b5ff834b24b /llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | |
parent | 1c7f32334d4becc725b9025fd32291a0e5729acd (diff) | |
download | llvm-bc7d15c61da78864b35e3c114294d6e4db645611.zip llvm-bc7d15c61da78864b35e3c114294d6e4db645611.tar.gz llvm-bc7d15c61da78864b35e3c114294d6e4db645611.tar.bz2 |
[NFC] Use ArgListEntry indirect types more in ISel lowering
For opaque pointers, we're trying to avoid uses of
PointerType::getElementType().
A couple of ISel places use PointerType::getElementType(). Some of these
are easy to fix by using ArgListEntry's indirect types.
The inalloca type wasn't stored there, as opposed to preallocated and
byval which have their indirect types available, so add it and use it.
This is a reland after an MSan fix in D102667.
Differential Revision: https://reviews.llvm.org/D101713
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 945beec..4f37f86 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -9464,7 +9464,7 @@ TargetLowering::LowerCallTo(TargetLowering::CallLoweringInfo &CLI) const { // FIXME: Split arguments if CLI.IsPostTypeLegalization Type *FinalType = Args[i].Ty; if (Args[i].IsByVal) - FinalType = cast<PointerType>(Args[i].Ty)->getElementType(); + FinalType = Args[i].IndirectType; bool NeedsRegBlock = functionArgumentNeedsConsecutiveRegisters( FinalType, CLI.CallConv, CLI.IsVarArg); for (unsigned Value = 0, NumValues = ValueVTs.size(); Value != NumValues; @@ -9537,11 +9537,10 @@ TargetLowering::LowerCallTo(TargetLowering::CallLoweringInfo &CLI) const { } Align MemAlign; if (Args[i].IsByVal || Args[i].IsInAlloca || Args[i].IsPreallocated) { - PointerType *Ty = cast<PointerType>(Args[i].Ty); - Type *ElementTy = Ty->getElementType(); + Type *ElementTy = Args[i].IndirectType; + assert(ElementTy && "Indirect type not set in ArgListEntry"); - unsigned FrameSize = DL.getTypeAllocSize( - Args[i].ByValType ? Args[i].ByValType : ElementTy); + unsigned FrameSize = DL.getTypeAllocSize(ElementTy); Flags.setByValSize(FrameSize); // info is not there but there are cases it cannot get right. |