[llvm] r365769 - OpaquePtr: use byval accessor instead of inspecting pointer type. NFC.

Tim Northover via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 11 06:12:38 PDT 2019


Author: tnorthover
Date: Thu Jul 11 06:12:38 2019
New Revision: 365769

URL: http://llvm.org/viewvc/llvm-project?rev=365769&view=rev
Log:
OpaquePtr: use byval accessor instead of inspecting pointer type. NFC.

The accessor can deal with both "byval(ty)" and "ty* byval" forms
seamlessly.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=365769&r1=365768&r2=365769&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Thu Jul 11 06:12:38 2019
@@ -9491,7 +9491,7 @@ void SelectionDAGISel::LowerArguments(co
     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(co
           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




More information about the llvm-commits mailing list