[llvm] 8c830d3 - [VPlan] Merge cases inferring type of operand 0 (NFC).
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 8 13:03:33 PST 2026
Author: Florian Hahn
Date: 2026-01-08T21:03:00Z
New Revision: 8c830d3117e0f19fceb9a2657562831c350d438f
URL: https://github.com/llvm/llvm-project/commit/8c830d3117e0f19fceb9a2657562831c350d438f
DIFF: https://github.com/llvm/llvm-project/commit/8c830d3117e0f19fceb9a2657562831c350d438f.diff
LOG: [VPlan] Merge cases inferring type of operand 0 (NFC).
Merge all cases that infer the scalar type of operand 0 in
inferScalarTypeForRecipe(const VPInstruction).
Added:
Modified:
llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp b/llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp
index e1736d3411482..27e7915a71675 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp
@@ -75,8 +75,18 @@ Type *VPTypeAnalysis::inferScalarTypeForRecipe(const VPInstruction *R) {
switch (Opcode) {
case Instruction::ExtractElement:
case Instruction::Freeze:
+ case Instruction::PHI:
+ case VPInstruction::Broadcast:
+ case VPInstruction::ComputeFindIVResult:
+ case VPInstruction::ComputeReductionResult:
+ case VPInstruction::ExtractLastLane:
+ case VPInstruction::ExtractPenultimateElement:
+ case VPInstruction::ExtractLastPart:
+ case VPInstruction::PtrAdd:
+ case VPInstruction::WidePtrAdd:
case VPInstruction::ReductionStartVector:
case VPInstruction::ResumeForEpilogue:
+ case VPInstruction::Reverse:
return inferScalarType(R->getOperand(0));
case Instruction::Select: {
Type *ResTy = inferScalarType(R->getOperand(1));
@@ -95,16 +105,8 @@ Type *VPTypeAnalysis::inferScalarTypeForRecipe(const VPInstruction *R) {
return IntegerType::get(Ctx, 1);
case VPInstruction::ComputeAnyOfResult:
return inferScalarType(R->getOperand(1));
- case VPInstruction::ComputeFindIVResult:
- case VPInstruction::ComputeReductionResult: {
- return inferScalarType(R->getOperand(0));
- }
case VPInstruction::ExplicitVectorLength:
return Type::getIntNTy(Ctx, 32);
- case Instruction::PHI:
- // Infer the type of first operand only, as other operands of header phi's
- // may lead to infinite recursion.
- return inferScalarType(R->getOperand(0));
case VPInstruction::FirstOrderRecurrenceSplice:
case VPInstruction::Not:
case VPInstruction::CalculateTripCountMinusVF:
@@ -119,22 +121,11 @@ Type *VPTypeAnalysis::inferScalarTypeForRecipe(const VPInstruction *R) {
case VPInstruction::FirstActiveLane:
case VPInstruction::LastActiveLane:
return Type::getIntNTy(Ctx, 64);
- case VPInstruction::ExtractLastLane:
- case VPInstruction::ExtractPenultimateElement:
- return inferScalarType(R->getOperand(0));
- case VPInstruction::ExtractLastPart:
- return inferScalarType(R->getOperand(0));
case VPInstruction::LogicalAnd:
assert(inferScalarType(R->getOperand(0))->isIntegerTy(1) &&
inferScalarType(R->getOperand(1))->isIntegerTy(1) &&
"LogicalAnd operands should be bool");
return IntegerType::get(Ctx, 1);
- case VPInstruction::Broadcast:
- case VPInstruction::PtrAdd:
- case VPInstruction::WidePtrAdd:
- case VPInstruction::Reverse:
- // Return the type based on first operand.
- return inferScalarType(R->getOperand(0));
case VPInstruction::BranchOnCond:
case VPInstruction::BranchOnTwoConds:
case VPInstruction::BranchOnCount:
More information about the llvm-commits
mailing list