[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 04:55:11 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:

The vectors can also have float values, but that would not preclude the `FixedVectorType`. The idea behind the assert was that when you use this function to get the operand type for a given intrinsics vector operand, to check that you supplied the correct operand index, so we don't run into the same error that motivated this PR in the first place.

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


More information about the llvm-commits mailing list