Skip to content

Commit 0d39fe6

Browse files
committed
[VPlan] Handle VPDerivedIV and more VPInsts in isUniformAfterVector.
In preparation for re-landing #112147, also consider VPDerivedIVRecipe and VPInstructions with binary opcodes and PtrAdd with all uniform operands as uniform themselves. Effectively NFC, but will be exercised once #112147 re-lands.
1 parent 6adeda8 commit 0d39fe6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

llvm/lib/Transforms/Vectorize/VPlanUtils.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,13 @@ inline bool isUniformAfterVectorization(const VPValue *VPV) {
4848
if (auto *GEP = dyn_cast<VPWidenGEPRecipe>(Def))
4949
return all_of(GEP->operands(), isUniformAfterVectorization);
5050
if (auto *VPI = dyn_cast<VPInstruction>(Def))
51-
return VPI->isSingleScalar() || VPI->isVectorToScalar();
51+
return VPI->isSingleScalar() || VPI->isVectorToScalar() ||
52+
((Instruction::isBinaryOp(VPI->getOpcode()) ||
53+
VPI->getOpcode() == VPInstruction::PtrAdd) &&
54+
all_of(VPI->operands(), isUniformAfterVectorization));
55+
if (auto *IV = dyn_cast<VPDerivedIVRecipe>(Def))
56+
return all_of(IV->operands(), isUniformAfterVectorization);
57+
5258
// VPExpandSCEVRecipes must be placed in the entry and are alway uniform.
5359
return isa<VPExpandSCEVRecipe>(Def);
5460
}

0 commit comments

Comments
 (0)