[OpaquePointers][CallPromotion] Don't look at pointee type for byval
authorArthur Eubanks <aeubanks@google.com>
Fri, 9 Jul 2021 16:32:40 +0000 (09:32 -0700)
committerArthur Eubanks <aeubanks@google.com>
Fri, 9 Jul 2021 16:34:05 +0000 (09:34 -0700)
byval's type parameter is now always required.

llvm/lib/Transforms/Utils/CallPromotionUtils.cpp

index bf08bf2..8786825 100644 (file)
@@ -490,11 +490,8 @@ CallBase &llvm::promoteCall(CallBase &CB, Function *Callee,
 
       // If byval is used, this must be a pointer type, and the byval type must
       // match the element type. Update it if present.
-      if (ArgAttrs.getByValType()) {
-        Type *NewTy = Callee->getParamByValType(ArgNo);
-        ArgAttrs.addByValAttr(
-            NewTy ? NewTy : cast<PointerType>(FormalTy)->getElementType());
-      }
+      if (ArgAttrs.getByValType())
+        ArgAttrs.addByValAttr(Callee->getParamByValType(ArgNo));
 
       NewArgAttrs.push_back(AttributeSet::get(Ctx, ArgAttrs));
       AttributeChanged = true;