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

Maciej Gabka via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 7 10:37:22 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:

are there any tests, testing this logic? I think the pow case is working thanks to the condition added to line 114

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


More information about the llvm-commits mailing list