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

Tex Riddell via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 9 14:30:31 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;
----------------
tex3d wrote:

It only calls this for IntrinsicInst, but some of those have `getIntrinsicID() == Intrinsic::not_intrinsic`.  This caused the assert to fire in `isVectorIntrinsicWithOverloadTypeAtArg`.  Some hits were in an AMDGPU nop intrinsic, but there were others as well.  I'm afraid I don't still have the list of tests on hand that asserted without this.

Before this check, we would have exited a little later, usually when an argument returned false from `isVectorIntrinsicWithScalarOpAtArg` and also wasn't a vector type.

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


More information about the llvm-commits mailing list