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

Jonas Paulsson via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 18 05:11:03 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);
+}
+
----------------
JonPsson1 wrote:

I think that is over-asserting as the operand index / type never changes and is trivially entered just once and has to be correct per the language spec.

The problem was that we handled some other intrinsic by accident, not that we messed up the operand index of the one we are handling, right?

Do you agree, or you think I am missing something here?



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


More information about the llvm-commits mailing list