[llvm] Fix scalar overload name constructed by ReplaceWithVeclib.cpp (PR #111095)
Farzon Lotfi via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 3 21:12:03 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())) {
----------------
farzonl wrote:
We seem to be duplicating things used later and i'm wonder if it wouldn't be better to store some of this stuff in variables like :
- `isVectorIntrinsicWithScalarOpAtArg(IID, Arg.index()`
- `auto *VectorArgTy = dyn_cast<VectorType>(ArgTy)`
If you do that you should be able to flatten the conditional and combine it with the conditionals on 127 ans 129
https://github.com/llvm/llvm-project/pull/111095
More information about the llvm-commits
mailing list