Remove the function attr cache for intrinsics. This does not maintain the
authorChris Lattner <sabre@nondot.org>
Thu, 3 Jan 2008 01:20:12 +0000 (01:20 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 3 Jan 2008 01:20:12 +0000 (01:20 +0000)
refcount on these correctly, and can end up referring to deleted
attributes.  This fixes PR1881.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45525 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Function.cpp

index b9a139d75b4bb5fcacf160773fa5158fa9ff38fc..8e6570a62721b96274946852b214572f5573525e 100644 (file)
@@ -325,11 +325,6 @@ const FunctionType *Intrinsic::getType(ID id, const Type **Tys,
 }
 
 const ParamAttrsList *Intrinsic::getParamAttrs(ID id) {
-  static const ParamAttrsList *IntrinsicAttributes[Intrinsic::num_intrinsics];
-
-  if (IntrinsicAttributes[id])
-    return IntrinsicAttributes[id];
-
   ParamAttrsVector Attrs;
   uint16_t Attr = ParamAttr::None;
 
@@ -341,8 +336,7 @@ const ParamAttrsList *Intrinsic::getParamAttrs(ID id) {
   Attr |= ParamAttr::NoUnwind;
 
   Attrs.push_back(ParamAttrsWithIndex::get(0, Attr));
-  IntrinsicAttributes[id] = ParamAttrsList::get(Attrs);
-  return IntrinsicAttributes[id];
+  return ParamAttrsList::get(Attrs);
 }
 
 Function *Intrinsic::getDeclaration(Module *M, ID id, const Type **Tys,