[llvm] a3fa1d5 - [NFC] Remove check for callee parameter elementtype

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 11 13:43:59 PST 2022


Author: Arthur Eubanks
Date: 2022-02-11T13:43:51-08:00
New Revision: a3fa1d5071d50ccb499bf015aa61a69f67b63fa8

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

LOG: [NFC] Remove check for callee parameter elementtype

elementtype is only allowed on caller arguments.

Added: 
    

Modified: 
    llvm/include/llvm/IR/InstrTypes.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/InstrTypes.h b/llvm/include/llvm/IR/InstrTypes.h
index f560d73fc41bd..35c1ef5514b29 100644
--- a/llvm/include/llvm/IR/InstrTypes.h
+++ b/llvm/include/llvm/IR/InstrTypes.h
@@ -1779,13 +1779,11 @@ class CallBase : public Instruction {
     return nullptr;
   }
 
-  /// Extract the elementtype type for a call or parameter.
+  /// Extract the elementtype type for a parameter.
+  /// Note that elementtype() can only be applied to call arguments, not
+  /// function declaration parameters.
   Type *getParamElementType(unsigned ArgNo) const {
-    if (auto *Ty = Attrs.getParamElementType(ArgNo))
-      return Ty;
-    if (const Function *F = getCalledFunction())
-      return F->getAttributes().getParamElementType(ArgNo);
-    return nullptr;
+    return Attrs.getParamElementType(ArgNo);
   }
 
   /// Extract the number of dereferenceable bytes for a call or


        


More information about the llvm-commits mailing list