Skip to content

Commit

Permalink
[VPlan] Improve printing of VPReplicateRecipe with calls.
Browse files Browse the repository at this point in the history
Suggested as part of D124718.
  • Loading branch information
fhahn committed May 15, 2022
1 parent c0f59be commit 3955296
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions llvm/lib/Transforms/Vectorize/VPlan.cpp
Expand Up @@ -1433,8 +1433,17 @@ void VPReplicateRecipe::print(raw_ostream &O, const Twine &Indent,
printAsOperand(O, SlotTracker);
O << " = ";
}
O << Instruction::getOpcodeName(getUnderlyingInstr()->getOpcode()) << " ";
printOperands(O, SlotTracker);
if (auto *CB = dyn_cast<CallBase>(getUnderlyingInstr())) {
O << "call @" << CB->getCalledFunction()->getName() << "(";
interleaveComma(make_range(op_begin(), op_begin() + (getNumOperands() - 1)),
O, [&O, &SlotTracker](VPValue *Op) {
Op->printAsOperand(O, SlotTracker);
});
O << ")";
} else {
O << Instruction::getOpcodeName(getUnderlyingInstr()->getOpcode()) << " ";
printOperands(O, SlotTracker);
}

if (AlsoPack)
O << " (S->V)";
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopVectorize/interleave-with-call.ll
Expand Up @@ -12,7 +12,7 @@
; CHECK-NEXT: vector.body:
; CHECK-NEXT: EMIT vp<[[CAN_IV:%.+]]> = CANONICAL-INDUCTION
; CHECK-NEXT: vp<[[IV_STEPS:%.]]> = SCALAR-STEPS vp<[[CAN_IV]]>, ir<%start>, ir<1>
; CHECK-NEXT: CLONE ir<%min> = call vp<[[IV_STEPS]]>, ir<65535>, ir<@llvm.smin.i32>
; CHECK-NEXT: CLONE ir<%min> = call @llvm.smin.i32(vp<[[IV_STEPS]]>, ir<65535>)
; CHECK-NEXT: CLONE ir<%arrayidx> = getelementptr ir<%dst>, vp<[[IV_STEPS]]>
; CHECK-NEXT: CLONE store ir<%min>, ir<%arrayidx>
; CHECK-NEXT: EMIT vp<[[INC:%.+]]> = VF * UF +(nuw) vp<[[CAN_IV]]>
Expand Down

0 comments on commit 3955296

Please sign in to comment.