diff options
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r-- | llvm/lib/IR/Function.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index 24f2f3b..4b0124c 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -523,9 +523,11 @@ Intrinsic::ID Function::lookupIntrinsicID(StringRef Name) { Intrinsic::ID ID = static_cast<Intrinsic::ID>(Idx + Adjust); // If the intrinsic is not overloaded, require an exact match. If it is - // overloaded, require a prefix match. - bool IsPrefixMatch = Name.size() > strlen(NameTable[Idx]); - return IsPrefixMatch == isOverloaded(ID) ? ID : Intrinsic::not_intrinsic; + // overloaded, require either exact or prefix match. + const auto MatchSize = strlen(NameTable[Idx]); + assert(Name.size() >= MatchSize && "Expected either exact or prefix match"); + bool IsExactMatch = Name.size() == MatchSize; + return IsExactMatch || isOverloaded(ID) ? ID : Intrinsic::not_intrinsic; } void Function::recalculateIntrinsicID() { |