Skip to content

Commit 9546b5d

Browse files
[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.
1 parent 173fd67 commit 9546b5d

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

llvm/lib/Analysis/TargetLibraryInfo.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ StringLiteral const TargetLibraryInfoImpl::StandardNames[LibFunc::NumLibFuncs] =
4646
};
4747

4848
std::string VecDesc::getVectorFunctionABIVariantString() const {
49+
assert(!VectorFnName.empty() && "Vector function name must not be empty.");
4950
SmallString<256> Buffer;
5051
llvm::raw_svector_ostream Out(Buffer);
5152
Out << VABIPrefix << "_" << ScalarFnName << "(" << VectorFnName << ")";

llvm/lib/Transforms/Utils/InjectTLIMappings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static void addMappingsFromTLI(const TargetLibraryInfo &TLI, CallInst &CI) {
9292

9393
auto AddVariantDecl = [&](const ElementCount &VF, bool Predicate) {
9494
const VecDesc *VD = TLI.getVectorMappingInfo(ScalarName, VF, Predicate);
95-
if (VD) {
95+
if (VD && !VD->getVectorFnName().empty()) {
9696
std::string MangledName = VD->getVectorFunctionABIVariantString();
9797
if (!OriginalSetOfMappings.count(MangledName)) {
9898
Mappings.push_back(MangledName);

0 commit comments

Comments
 (0)