[llvm] [SystemZ] Fix Operand Retrieval for Vector Reduction Intrinsic in `shouldExpandReduction` (PR #88874)

Dominik Steenken via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 18 05:13:59 PDT 2024


================
@@ -1322,26 +1323,30 @@ SystemZTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
   return BaseT::getIntrinsicInstrCost(ICA, CostKind);
 }
 
+// Find the type of the vector operand indicated by index.
+// Asserts that the operand indicated is actually a vector.
+FixedVectorType *getOperandVectorType(const IntrinsicInst *II, unsigned Index) {
+  auto *T = II->getOperand(Index)->getType();
+  assert(T->isVectorTy());
+  return cast<FixedVectorType>(T);
+}
+
----------------
dominik-steenken wrote:

I think handling other intrinsics was intended (but primarily for future use), and the problem arose because some of them had the vector operand in a different place.

But this is not a hill i'm willing to die on. If you prefer to not have the assert and then move the cast out of the function and back into the cast, i'll do that.

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


More information about the llvm-commits mailing list