From 9cbc30103598be2d45e3c93991f2d356835860f5 Mon Sep 17 00:00:00 2001 From: Justin Lebar Date: Thu, 28 Jul 2016 23:58:15 +0000 Subject: Revert "Don't invoke getName() from Function::isIntrinsic().", rL276942. This broke some out-of-tree AMDGPU tests that relied on the old behavior wherein isIntrinsic() would return true for any function that starts with "llvm.". And in general that change will not play nicely with out-of-tree backends. llvm-svn: 277087 --- llvm/lib/IR/Function.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'llvm/lib/IR/Function.cpp') 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 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 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 -- cgit v1.2.3