From 2a2e351b9dbebba776565e49bdb2d84834431c33 Mon Sep 17 00:00:00 2001 From: Tim Northover Date: Thu, 11 Jul 2019 13:12:38 +0000 Subject: [PATCH] OpaquePtr: use byval accessor instead of inspecting pointer type. NFC. The accessor can deal with both "byval(ty)" and "ty* byval" forms seamlessly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365769 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index adcb0b37547..61ec29261c3 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -9491,7 +9491,7 @@ void SelectionDAGISel::LowerArguments(const Function &F) { unsigned PartBase = 0; Type *FinalType = Arg.getType(); if (Arg.hasAttribute(Attribute::ByVal)) - FinalType = cast(FinalType)->getElementType(); + FinalType = Arg.getParamByValType(); bool NeedsRegBlock = TLI->functionArgumentNeedsConsecutiveRegisters( FinalType, F.getCallingConv(), F.isVarArg()); for (unsigned Value = 0, NumValues = ValueVTs.size(); @@ -9551,8 +9551,7 @@ void SelectionDAGISel::LowerArguments(const Function &F) { Flags.setByVal(); } if (Flags.isByVal() || Flags.isInAlloca()) { - PointerType *Ty = cast(Arg.getType()); - Type *ElementTy = Ty->getElementType(); + Type *ElementTy = Arg.getParamByValType(); // For ByVal, size and alignment should be passed from FE. BE will // guess if this info is not there but there are cases it cannot get -- 2.50.1