summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Function.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r--llvm/lib/IR/Function.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index d9c59241ddf..e1223d0d033 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -488,7 +488,9 @@ static ArrayRef<const char *> findTargetSubtable(StringRef Name) {
/// \brief This does the actual lookup of an intrinsic ID which
/// matches the given function name.
-static Intrinsic::ID lookupIntrinsicID(StringRef Name) {
+static Intrinsic::ID lookupIntrinsicID(const ValueName *ValName) {
+ StringRef Name = ValName->getKey();
+
ArrayRef<const char *> NameTable = findTargetSubtable(Name);
int Idx = Intrinsic::lookupLLVMIntrinsicByName(NameTable, Name);
if (Idx == -1)
@@ -506,11 +508,12 @@ static Intrinsic::ID lookupIntrinsicID(StringRef Name) {
}
void Function::recalculateIntrinsicID() {
- if (!hasLLVMReservedName()) {
+ const ValueName *ValName = this->getValueName();
+ if (!ValName || !isIntrinsic()) {
IntID = Intrinsic::not_intrinsic;
return;
}
- IntID = lookupIntrinsicID(getName());
+ IntID = lookupIntrinsicID(ValName);
}
/// Returns a stable mangling for the type specified for use in the name
OpenPOWER on IntegriCloud