]> granicus.if.org Git - llvm/commitdiff
OpaquePtr: use byval accessor instead of inspecting pointer type. NFC.
authorTim Northover <tnorthover@apple.com>
Thu, 11 Jul 2019 13:12:38 +0000 (13:12 +0000)
committerTim Northover <tnorthover@apple.com>
Thu, 11 Jul 2019 13:12:38 +0000 (13:12 +0000)
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

index adcb0b37547646c5a57a1360c211bab40c9dc4f1..61ec29261c39642ed56aed0761fba586fbba59c7 100644 (file)
@@ -9491,7 +9491,7 @@ void SelectionDAGISel::LowerArguments(const Function &F) {
     unsigned PartBase = 0;
     Type *FinalType = Arg.getType();
     if (Arg.hasAttribute(Attribute::ByVal))
-      FinalType = cast<PointerType>(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<PointerType>(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