[llvm] Fix mechanism propagating mangled names for TLI function mappings (PR #66656)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 25 02:22:19 PDT 2023
================
@@ -23,860 +23,860 @@
#define MASKED true
#if !(defined(TLI_DEFINE_VECFUNC))
-#define TLI_DEFINE_VECFUNC(SCAL, VEC, VF) {SCAL, VEC, VF, NOMASK},
+#define TLI_DEFINE_VECFUNC(SCAL, VEC, VF, MANGLN) {SCAL, VEC, VF, NOMASK, MANGLN},
#endif
#if defined(TLI_DEFINE_ACCELERATE_VECFUNCS)
// Accelerate framework's Vector Functions
// Floating-Point Arithmetic and Auxiliary Functions
-TLI_DEFINE_VECFUNC("ceilf", "vceilf", FIXED(4))
-TLI_DEFINE_VECFUNC("fabsf", "vfabsf", FIXED(4))
-TLI_DEFINE_VECFUNC("llvm.fabs.f32", "vfabsf", FIXED(4))
-TLI_DEFINE_VECFUNC("floorf", "vfloorf", FIXED(4))
-TLI_DEFINE_VECFUNC("sqrtf", "vsqrtf", FIXED(4))
-TLI_DEFINE_VECFUNC("llvm.sqrt.f32", "vsqrtf", FIXED(4))
+TLI_DEFINE_VECFUNC("ceilf", "vceilf", FIXED(4), "_ZGV_LLVM_N4v_ceilf(vceilf)")
----------------
JolantaJensen wrote:
I'm afraid I cannot shorten the mangled name removing the optional part.
If I do I'll crash in VFABI::setVectorVariantNames() with
assert(VI && "Cannot add an invalid VFABI name.").
The culprit is the code below. VectorName will only be changed if there
is an optional part. For LLVM isa this causes a std::nullopt return
because the VectorName is unchanged and equals OriginalName.
std::optional<VFInfo> VFABI::tryDemangleForVFABI(StringRef MangledName,
const Module &M) {
const StringRef OriginalName = MangledName;
StringRef VectorName = MangledName;
...
// Reduce MangledName to [(<redirection>)].
MangledName = MangledName.ltrim(ScalarName);
// Find the optional custom name redirection.
if (MangledName.consume_front("(")) {
if (!MangledName.consume_back(")"))
return std::nullopt;
// Update the vector variant with the one specified by the user.
VectorName = MangledName;
// If the vector name is missing, bail out.
if (VectorName.empty())
return std::nullopt;
}
// LLVM internal mapping via the TargetLibraryInfo (TLI) must be
// redirected to an existing name.
if (ISA == VFISAKind::LLVM && VectorName == OriginalName)
return std::nullopt;
Sorry for not formatting the above as code but this removes all line breaks for me.
https://github.com/llvm/llvm-project/pull/66656
More information about the llvm-commits
mailing list