diff --git a/llvm/include/llvm/IR/Function.h b/llvm/include/llvm/IR/Function.h --- a/llvm/include/llvm/IR/Function.h +++ b/llvm/include/llvm/IR/Function.h @@ -225,13 +225,6 @@ static Intrinsic::ID lookupIntrinsicID(StringRef Name); - /// Recalculate the ID for this function if it is an Intrinsic defined - /// in llvm/Intrinsics.h. Sets the intrinsic ID to Intrinsic::not_intrinsic - /// if the name of this function does not match an intrinsic in that header. - /// Note, this method does not need to be called directly, as it is called - /// from Value::setName() whenever the name of this function changes. - void recalculateIntrinsicID(); - /// getCallingConv()/setCallingConv(CC) - These method get and set the /// calling convention of this function. The enum values for the known /// calling conventions are defined in CallingConv.h. diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -399,7 +399,13 @@ if (ParentModule) ParentModule->getFunctionList().push_back(this); - HasLLVMReservedName = getName().startswith("llvm."); + if (getName().startswith("llvm.")) { + HasLLVMReservedName = true; + IntID = lookupIntrinsicID(getName()); + } else { + HasLLVMReservedName = false; + IntID = Intrinsic::not_intrinsic; + } // Ensure intrinsics have the right parameter attributes. // Note, the IntID field will have been set in Value::setName if this function // name is a valid intrinsic ID. @@ -787,17 +793,6 @@ : Intrinsic::not_intrinsic; } -void Function::recalculateIntrinsicID() { - StringRef Name = getName(); - if (!Name.startswith("llvm.")) { - HasLLVMReservedName = false; - IntID = Intrinsic::not_intrinsic; - return; - } - HasLLVMReservedName = true; - IntID = lookupIntrinsicID(Name); -} - /// Returns a stable mangling for the type specified for use in the name /// mangling scheme used by 'any' types in intrinsic signatures. The mangling /// of named types is simply their name. Manglings for unnamed types consist diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp --- a/llvm/lib/IR/Value.cpp +++ b/llvm/lib/IR/Value.cpp @@ -371,8 +371,6 @@ void Value::setName(const Twine &NewName) { setNameImpl(NewName); - if (Function *F = dyn_cast(this)) - F->recalculateIntrinsicID(); } void Value::takeName(Value *V) {