[llvm] [VPlan] Clean up the function VPInstruction::generate for ComputeReductionResult, nfc (PR #140245)
Mel Chen via llvm-commits
llvm-commits at lists.llvm.org
Mon May 19 01:19:12 PDT 2025
https://github.com/Mel-Chen updated https://github.com/llvm/llvm-project/pull/140245
>From 5aa8057b4ca9038b736fb2713dba591b3956e44a Mon Sep 17 00:00:00 2001
From: Mel Chen <mel.chen at sifive.com>
Date: Fri, 16 May 2025 04:55:54 -0700
Subject: [PATCH] clean up the generate of ComputeReductionResult
---
llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index f82c29938b632..14ed40f16683a 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -678,7 +678,6 @@ Value *VPInstruction::generate(VPTransformState &State) {
}
// Reduce all of the unrolled parts into a single vector.
Value *ReducedPartRdx = RdxParts[0];
- unsigned Op = RdxDesc.getOpcode();
if (PhiR->isOrdered()) {
ReducedPartRdx = RdxParts[UF - 1];
} else {
@@ -687,11 +686,12 @@ Value *VPInstruction::generate(VPTransformState &State) {
Builder.setFastMathFlags(RdxDesc.getFastMathFlags());
for (unsigned Part = 1; Part < UF; ++Part) {
Value *RdxPart = RdxParts[Part];
- if (Op != Instruction::ICmp && Op != Instruction::FCmp)
- ReducedPartRdx = Builder.CreateBinOp(
- (Instruction::BinaryOps)Op, RdxPart, ReducedPartRdx, "bin.rdx");
- else
+ if (RecurrenceDescriptor::isMinMaxRecurrenceKind(RK))
ReducedPartRdx = createMinMaxOp(Builder, RK, ReducedPartRdx, RdxPart);
+ else
+ ReducedPartRdx =
+ Builder.CreateBinOp((Instruction::BinaryOps)RdxDesc.getOpcode(),
+ RdxPart, ReducedPartRdx, "bin.rdx");
}
}
More information about the llvm-commits
mailing list