[NVPTXLowerArgs] Use byval type
authorNikita Popov <npopov@redhat.com>
Tue, 8 Feb 2022 10:41:45 +0000 (11:41 +0100)
committerNikita Popov <npopov@redhat.com>
Tue, 8 Feb 2022 10:41:45 +0000 (11:41 +0100)
Instead of pointer element type.

llvm/lib/Target/NVPTX/NVPTXLowerArgs.cpp

index 67aa491..6183019 100644 (file)
@@ -229,11 +229,8 @@ static void convertToParamAS(Value *OldUser, Value *Param) {
 void NVPTXLowerArgs::handleByValParam(Argument *Arg) {
   Function *Func = Arg->getParent();
   Instruction *FirstInst = &(Func->getEntryBlock().front());
-  PointerType *PType = dyn_cast<PointerType>(Arg->getType());
-
-  assert(PType && "Expecting pointer type in handleByValParam");
-
-  Type *StructType = PType->getPointerElementType();
+  Type *StructType = Arg->getParamByValType();
+  assert(StructType && "Missing byval type");
 
   auto IsALoadChain = [&](Value *Start) {
     SmallVector<Value *, 16> ValuesToCheck = {Start};