[llvm] [TLI] Added a guard for empty vector function name. (PR #68100)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 3 06:26:54 PDT 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-analysis
<details>
<summary>Changes</summary>
A guard for empty vector function name was removed in #<!-- -->66656. This patch adds the guard back.
---
Full diff: https://github.com/llvm/llvm-project/pull/68100.diff
2 Files Affected:
- (modified) llvm/lib/Analysis/TargetLibraryInfo.cpp (+1)
- (modified) llvm/lib/Transforms/Utils/InjectTLIMappings.cpp (+1-1)
``````````diff
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);
``````````
</details>
https://github.com/llvm/llvm-project/pull/68100
More information about the llvm-commits
mailing list