Index: include/llvm/IR/Function.h =================================================================== --- include/llvm/IR/Function.h +++ include/llvm/IR/Function.h @@ -25,6 +25,7 @@ #include "llvm/IR/BasicBlock.h" #include "llvm/IR/CallingConv.h" #include "llvm/IR/GlobalObject.h" +#include "llvm/IR/Intrinsics.h" #include "llvm/IR/OperandTraits.h" #include "llvm/Support/Compiler.h" @@ -157,7 +158,9 @@ /// The particular intrinsic functions which correspond to this value are /// defined in llvm/Intrinsics.h. Intrinsic::ID getIntrinsicID() const LLVM_READONLY { return IntID; } - bool isIntrinsic() const { return getName().startswith("llvm."); } + bool isIntrinsic() const { + return getIntrinsicID() != Intrinsic::not_intrinsic; + } /// \brief Recalculate the ID for this function if it is an Intrinsic defined /// in llvm/Intrinsics.h. Sets the intrinsic ID to Intrinsic::not_intrinsic Index: lib/IR/Function.cpp =================================================================== --- lib/IR/Function.cpp +++ lib/IR/Function.cpp @@ -462,7 +462,7 @@ void Function::recalculateIntrinsicID() { const ValueName *ValName = this->getValueName(); - if (!ValName || !isIntrinsic()) { + if (!ValName || !getName().startswith("llvm.")) { IntID = Intrinsic::not_intrinsic; return; }