[llvm] Fix scalar overload name constructed by ReplaceWithVeclib.cpp (PR #111095)
Maciej Gabka via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 9 12:35:02 PDT 2024
================
@@ -100,20 +100,39 @@ static void replaceWithTLIFunction(IntrinsicInst *II, VFInfo &Info,
static bool replaceWithCallToVeclib(const TargetLibraryInfo &TLI,
IntrinsicInst *II) {
assert(II != nullptr && "Intrinsic cannot be null");
- // At the moment VFABI assumes the return type is always widened unless it is
- // a void type.
- auto *VTy = dyn_cast<VectorType>(II->getType());
- ElementCount EC(VTy ? VTy->getElementCount() : ElementCount::getFixed(0));
+ Intrinsic::ID IID = II->getIntrinsicID();
+ if (IID == Intrinsic::not_intrinsic)
+ return false;
+
+ // RetIsScalar: Return type is not widened.
+ bool RetIsScalar = isVectorIntrinsicWithScalarOpAtArg(IID, -1);
+ Type *RetTy = II->getType();
+ Type *ScalarRetTy = RetTy->getScalarType();
+
// Compute the argument types of the corresponding scalar call and check that
// all vector operands match the previously found EC.
SmallVector<Type *, 8> ScalarArgTypes;
- Intrinsic::ID IID = II->getIntrinsicID();
+ auto *VTy = dyn_cast<VectorType>(RetTy);
+ ElementCount EC(!RetIsScalar && VTy ? VTy->getElementCount()
----------------
mgabka wrote:
the extra !RetIsScalar is not needed, if the return type is vector then isVectorIntrinsicWithScalarOpAtArg(IID, -1) return false, the original place where EC was computed was correct, could you please revert this change?
https://github.com/llvm/llvm-project/pull/111095
More information about the llvm-commits
mailing list