[llvm] [VPlan] Cleanup print functions of recipes (NFC) (PR #207434)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 3 10:34:59 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-vectorizers
Author: Ramkumar Ramachandra (artagnon)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/207434.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp (+9-13)
``````````diff
diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index 24abcf7646066..32785350b1d92 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
@@ -4013,7 +4009,7 @@ 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)),
+ interleaveComma(drop_end(operands()),
O, [&O, &SlotTracker](VPValue *Op) {
Op->printAsOperand(O, SlotTracker);
});
``````````
</details>
https://github.com/llvm/llvm-project/pull/207434
More information about the llvm-commits
mailing list