[llvm] Fix scalar overload name constructed by ReplaceWithVeclib.cpp (PR #111095)

Maciej Gabka via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 11 03:40:24 PDT 2024


================
@@ -108,8 +108,22 @@ static bool replaceWithCallToVeclib(const TargetLibraryInfo &TLI,
   // all vector operands match the previously found EC.
   SmallVector<Type *, 8> ScalarArgTypes;
   Intrinsic::ID IID = II->getIntrinsicID();
+
+  // OloadTys collects types used in scalar intrinsic overload name.
+  SmallVector<Type *, 3> OloadTys;
+  if (VTy && isVectorIntrinsicWithOverloadTypeAtArg(IID, -1))
+    OloadTys.push_back(VTy->getElementType());
+
   for (auto Arg : enumerate(II->args())) {
     auto *ArgTy = Arg.value()->getType();
+    // Gather type if it is used in the overload name.
+    if (isVectorIntrinsicWithOverloadTypeAtArg(IID, Arg.index())) {
----------------
mgabka wrote:

ah, there is one unit tests using "powi", which is overloaded on a scalar type.
For now we do not have mappings for it in the TLI, so there is no lit tests for it.


The regular pow is not affecting this code path as is only overloaded only on return type.

https://github.com/llvm/llvm-project/pull/111095


More information about the llvm-commits mailing list