[llvm] 0d39fe6 - [VPlan] Handle VPDerivedIV and more VPInsts in isUniformAfterVector.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 19 06:46:43 PST 2025
Author: Florian Hahn
Date: 2025-01-19T14:42:52Z
New Revision: 0d39fe6f5bb3edf0bddec09a8c6417377390aeac
URL: https://github.com/llvm/llvm-project/commit/0d39fe6f5bb3edf0bddec09a8c6417377390aeac
DIFF: https://github.com/llvm/llvm-project/commit/0d39fe6f5bb3edf0bddec09a8c6417377390aeac.diff
LOG: [VPlan] Handle VPDerivedIV and more VPInsts in isUniformAfterVector.
In preparation for re-landing
https://github.com/llvm/llvm-project/pull/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.
Added:
Modified:
llvm/lib/Transforms/Vectorize/VPlanUtils.h
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/VPlanUtils.h b/llvm/lib/Transforms/Vectorize/VPlanUtils.h
index 777944264f458e..275cdd7cf6b5d6 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanUtils.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanUtils.h
@@ -48,7 +48,13 @@ inline bool isUniformAfterVectorization(const VPValue *VPV) {
if (auto *GEP = dyn_cast<VPWidenGEPRecipe>(Def))
return all_of(GEP->operands(), isUniformAfterVectorization);
if (auto *VPI = dyn_cast<VPInstruction>(Def))
- return VPI->isSingleScalar() || VPI->isVectorToScalar();
+ return VPI->isSingleScalar() || VPI->isVectorToScalar() ||
+ ((Instruction::isBinaryOp(VPI->getOpcode()) ||
+ VPI->getOpcode() == VPInstruction::PtrAdd) &&
+ all_of(VPI->operands(), isUniformAfterVectorization));
+ if (auto *IV = dyn_cast<VPDerivedIVRecipe>(Def))
+ return all_of(IV->operands(), isUniformAfterVectorization);
+
// VPExpandSCEVRecipes must be placed in the entry and are alway uniform.
return isa<VPExpandSCEVRecipe>(Def);
}
More information about the llvm-commits
mailing list