[llvm] e4f66a1 - [OpaquePointers][CallPromotion] Don't look at pointee type for byval

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 9 09:34:29 PDT 2021


Author: Arthur Eubanks
Date: 2021-07-09T09:34:05-07:00
New Revision: e4f66a10556c82e2ebf2469fafc1c26639f15be8

URL: https://github.com/llvm/llvm-project/commit/e4f66a10556c82e2ebf2469fafc1c26639f15be8
DIFF: https://github.com/llvm/llvm-project/commit/e4f66a10556c82e2ebf2469fafc1c26639f15be8.diff

LOG: [OpaquePointers][CallPromotion] Don't look at pointee type for byval

byval's type parameter is now always required.

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/CallPromotionUtils.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/CallPromotionUtils.cpp b/llvm/lib/Transforms/Utils/CallPromotionUtils.cpp
index bf08bf274737..87868251036c 100644
--- a/llvm/lib/Transforms/Utils/CallPromotionUtils.cpp
+++ b/llvm/lib/Transforms/Utils/CallPromotionUtils.cpp
@@ -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;


        


More information about the llvm-commits mailing list