[llvm] 3955296 - [VPlan] Improve printing of VPReplicateRecipe with calls.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sun May 15 07:52:22 PDT 2022
Author: Florian Hahn
Date: 2022-05-15T15:51:26+01:00
New Revision: 39552964e168652ff6e9eaf31fc8cf11f046f3c2
URL: https://github.com/llvm/llvm-project/commit/39552964e168652ff6e9eaf31fc8cf11f046f3c2
DIFF: https://github.com/llvm/llvm-project/commit/39552964e168652ff6e9eaf31fc8cf11f046f3c2.diff
LOG: [VPlan] Improve printing of VPReplicateRecipe with calls.
Suggested as part of D124718.
Added:
Modified:
llvm/lib/Transforms/Vectorize/VPlan.cpp
llvm/test/Transforms/LoopVectorize/interleave-with-call.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp
index 21bd231db691d..de7846a95c923 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -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)";
diff --git a/llvm/test/Transforms/LoopVectorize/interleave-with-call.ll b/llvm/test/Transforms/LoopVectorize/interleave-with-call.ll
index 5cca6a64c1dc5..e089738860659 100644
--- a/llvm/test/Transforms/LoopVectorize/interleave-with-call.ll
+++ b/llvm/test/Transforms/LoopVectorize/interleave-with-call.ll
@@ -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]]>
More information about the llvm-commits
mailing list