[llvm] Fix scalar overload name constructed by ReplaceWithVeclib.cpp (PR #111095)
Tex Riddell via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 7 15:16:39 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())) {
----------------
tex3d wrote:
The `pow` case is impacted by both this logic and return type logic, since `OloadTys` should include only the return type for `pow`, not each of the argument types. `isVectorIntrinsicWithOverloadTypeAtArg()` is how you determine the arguments that the intrinsic is overloaded on, when not `void`, and defaults to -1 (return type).
Other tests will be running through this logic (and turning out the same), but the pow one is the only case with two arguments which had existing tests meant to match a vector lib call right now. `atan2` will be added soon, which also needs this. Other intrinsics could require this change in theory, if there's a matching vector lib call for them.
https://github.com/llvm/llvm-project/pull/111095
More information about the llvm-commits
mailing list