[llvm] 9546b5d - [TLI] Added a guard for empty vector function name. (#68100)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 3 07:11:37 PDT 2023


Author: JolantaJensen
Date: 2023-10-03T15:11:31+01:00
New Revision: 9546b5d8eec67e590694b4c62b8681cddd21662a

URL: https://github.com/llvm/llvm-project/commit/9546b5d8eec67e590694b4c62b8681cddd21662a
DIFF: https://github.com/llvm/llvm-project/commit/9546b5d8eec67e590694b4c62b8681cddd21662a.diff

LOG: [TLI] Added a guard for empty vector function name. (#68100)

A guard for empty vector function name was removed in #66656. This patch
adds the guard back.

Added: 
    

Modified: 
    llvm/lib/Analysis/TargetLibraryInfo.cpp
    llvm/lib/Transforms/Utils/InjectTLIMappings.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp
index 2b1c23710d00498..7b38583e9bc75f0 100644
--- a/llvm/lib/Analysis/TargetLibraryInfo.cpp
+++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp
@@ -46,6 +46,7 @@ StringLiteral const TargetLibraryInfoImpl::StandardNames[LibFunc::NumLibFuncs] =
 };
 
 std::string VecDesc::getVectorFunctionABIVariantString() const {
+  assert(!VectorFnName.empty() && "Vector function name must not be empty.");
   SmallString<256> Buffer;
   llvm::raw_svector_ostream Out(Buffer);
   Out << VABIPrefix << "_" << ScalarFnName << "(" << VectorFnName << ")";

diff  --git a/llvm/lib/Transforms/Utils/InjectTLIMappings.cpp b/llvm/lib/Transforms/Utils/InjectTLIMappings.cpp
index 04e67f713ac1167..0990c750af55f14 100644
--- a/llvm/lib/Transforms/Utils/InjectTLIMappings.cpp
+++ b/llvm/lib/Transforms/Utils/InjectTLIMappings.cpp
@@ -92,7 +92,7 @@ static void addMappingsFromTLI(const TargetLibraryInfo &TLI, CallInst &CI) {
 
   auto AddVariantDecl = [&](const ElementCount &VF, bool Predicate) {
     const VecDesc *VD = TLI.getVectorMappingInfo(ScalarName, VF, Predicate);
-    if (VD) {
+    if (VD && !VD->getVectorFnName().empty()) {
       std::string MangledName = VD->getVectorFunctionABIVariantString();
       if (!OriginalSetOfMappings.count(MangledName)) {
         Mappings.push_back(MangledName);


        


More information about the llvm-commits mailing list