[llvm] 5ccca5f - [VPlan] Cleanup print functions of recipes (NFC) (#207434)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 8 23:51:03 PDT 2026
Author: Ramkumar Ramachandra
Date: 2026-07-09T07:50:58+01:00
New Revision: 5ccca5f215939645995035ecd5fe40759e2cc0a6
URL: https://github.com/llvm/llvm-project/commit/5ccca5f215939645995035ecd5fe40759e2cc0a6
DIFF: https://github.com/llvm/llvm-project/commit/5ccca5f215939645995035ecd5fe40759e2cc0a6.diff
LOG: [VPlan] Cleanup print functions of recipes (NFC) (#207434)
In particular, VPPhiAccessors should not query the derivative recipe's
operands, and query incoming values instead. The printPhiOperands
function would crash if used in more derivative recipes.
Added:
Modified:
llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index 7a0201585e704..b19559ae3cfdc 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -2053,14 +2053,13 @@ void VPPhiAccessors::setIncomingValueForBlock(const VPBasicBlock *VPBB,
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
void VPPhiAccessors::printPhiOperands(raw_ostream &O,
VPSlotTracker &SlotTracker) const {
- interleaveComma(enumerate(getAsRecipe()->operands()), O,
- [this, &O, &SlotTracker](auto Op) {
- O << "[ ";
- Op.value()->printAsOperand(O, SlotTracker);
- O << ", ";
- getIncomingBlock(Op.index())->printAsOperand(O);
- O << " ]";
- });
+ interleaveComma(incoming_values_and_blocks(), O, [&O, &SlotTracker](auto Op) {
+ O << "[ ";
+ std::get<0>(Op)->printAsOperand(O, SlotTracker);
+ O << ", ";
+ std::get<1>(Op)->printAsOperand(O);
+ O << " ]";
+ });
}
#endif
@@ -2339,10 +2338,7 @@ void VPWidenIntrinsicRecipe::printRecipe(raw_ostream &O, const Twine &Indent,
O << "call";
printFlags(O);
O << getIntrinsicName() << "(";
-
- interleaveComma(operands(), O, [&O, &SlotTracker](VPValue *Op) {
- Op->printAsOperand(O, SlotTracker);
- });
+ printOperands(O, SlotTracker);
O << ")";
}
#endif
@@ -4010,10 +4006,9 @@ void VPReplicateRecipe::printRecipe(raw_ostream &O, const Twine &Indent,
O << "call";
printFlags(O);
O << "@" << CB->getCalledFunction()->getName() << "(";
- interleaveComma(make_range(op_begin(), op_begin() + (getNumOperands() - 1)),
- O, [&O, &SlotTracker](VPValue *Op) {
- Op->printAsOperand(O, SlotTracker);
- });
+ interleaveComma(drop_end(operands()), O, [&O, &SlotTracker](VPValue *Op) {
+ Op->printAsOperand(O, SlotTracker);
+ });
O << ")";
} else {
O << Instruction::getOpcodeName(getUnderlyingInstr()->getOpcode());
More information about the llvm-commits
mailing list