diff --git a/llvm/include/llvm/Analysis/VectorUtils.h b/llvm/include/llvm/Analysis/VectorUtils.h --- a/llvm/include/llvm/Analysis/VectorUtils.h +++ b/llvm/include/llvm/Analysis/VectorUtils.h @@ -164,20 +164,14 @@ /// name. At the moment, this parameter is needed only to retrieve the /// Vectorization Factor of scalable vector functions from their /// respective IR declarations. -/// \param AllowEmptyParameter -> If true, this function will try to demangle -/// even when the list is empty. The x86 VFABI doc explicitly -/// allows an empty parameter list. std::optional tryDemangleForVFABI(StringRef MangledName, - const Module &M, - bool AllowEmptyParameter = false); + const Module &M); /// \param M -> The pointer to module used to retrieve informations about the /// vector function. If nullptr is passed, we don't check the existence of /// the demangled vector function. std::optional tryDemangleForVFABI(StringRef MangledName, - const Module *M = nullptr, - bool AllowEmptyParameter = false); -VFInfo demangleForVFABI(StringRef MangledName, - bool AllowEmptyParameter = false); + const Module *M = nullptr); +VFInfo demangleForVFABI(StringRef MangledName); /// This routine mangles the given VectorName according to the LangRef /// specification for vector-function-abi-variant attribute and is specific to diff --git a/llvm/lib/Analysis/VFABIDemangling.cpp b/llvm/lib/Analysis/VFABIDemangling.cpp --- a/llvm/lib/Analysis/VFABIDemangling.cpp +++ b/llvm/lib/Analysis/VFABIDemangling.cpp @@ -312,25 +312,21 @@ } } // namespace -VFInfo VFABI::demangleForVFABI(StringRef MangledName, - bool AllowEmptyParameter) { - auto VI = VFABI::tryDemangleForVFABI(MangledName, /*M = */ nullptr, - AllowEmptyParameter); +VFInfo VFABI::demangleForVFABI(StringRef MangledName) { + auto VI = VFABI::tryDemangleForVFABI(MangledName, /*M = */ nullptr); assert(VI && "Invalid name for a VFABI variant."); return VI.value(); } std::optional VFABI::tryDemangleForVFABI(StringRef MangledName, - const Module &M, - bool AllowEmptyParameter) { - return VFABI::tryDemangleForVFABI(MangledName, &M, AllowEmptyParameter); + const Module &M) { + return VFABI::tryDemangleForVFABI(MangledName, &M); } // Format of the ABI name: // _ZGV_[()] std::optional VFABI::tryDemangleForVFABI(StringRef MangledName, - const Module *M, - bool AllowEmptyParameter) { + const Module *M) { const StringRef OriginalName = MangledName; // Assume there is no custom name , and therefore the // vector name consists of @@ -384,9 +380,6 @@ } } while (ParamFound == ParseRet::OK); - if (!AllowEmptyParameter && Parameters.empty()) - return std::nullopt; - // Check for the and the optional , which // are separated from the prefix with "_" if (!MangledName.consume_front("_")) diff --git a/llvm/unittests/Analysis/VectorFunctionABITest.cpp b/llvm/unittests/Analysis/VectorFunctionABITest.cpp --- a/llvm/unittests/Analysis/VectorFunctionABITest.cpp +++ b/llvm/unittests/Analysis/VectorFunctionABITest.cpp @@ -67,8 +67,7 @@ bool invokeParser(const StringRef MangledName, const StringRef VectorName = "", const StringRef IRType = "void()", - bool CheckVectorNameExistence = true, - bool AllowEmptyParameter = false) { + bool CheckVectorNameExistence = true) { StringRef Name = MangledName; if (!VectorName.empty()) Name = VectorName; @@ -76,11 +75,8 @@ // `invokeParser` multiple times in the same test. reset(Name, IRType); - const auto OptInfo = CheckVectorNameExistence - ? VFABI::tryDemangleForVFABI( - MangledName, *(M.get()), AllowEmptyParameter) - : VFABI::tryDemangleForVFABI(MangledName, nullptr, - AllowEmptyParameter); + const auto OptInfo = VFABI::tryDemangleForVFABI( + MangledName, CheckVectorNameExistence ? M.get() : nullptr); if (OptInfo) { Info = *OptInfo; return true; @@ -128,8 +124,6 @@ EXPECT_FALSE(invokeParser("_ZGVnN2")); EXPECT_FALSE(invokeParser("_ZGVnN2v")); EXPECT_FALSE(invokeParser("_ZGVnN2v_")); - // Missing parameters. - EXPECT_FALSE(invokeParser("_ZGVnN2_foo")); // Missing _ZGV prefix. EXPECT_FALSE(invokeParser("_ZVnN2v_foo")); // Missing . @@ -151,9 +145,8 @@ } TEST_F(VFABIParserTest, EmptyParamList) { - EXPECT_TRUE(invokeParser( - "_ZGVnN2_foo", /*VectorName = */ "", /*IRType = */ "void()", - /*CheckVectorNameExistence = */ true, /*AllowEmptyParameter = */ true)); + EXPECT_TRUE(invokeParser("_ZGVnN2_foo", /*VectorName = */ "", + /*IRType = */ "void()")); } TEST_F(VFABIParserTest, DontCheckVectorNameExistence) {