[llvm] [VPlan] First step towards VPlan cost modeling (LegacyCM in CostCtx) (PR #92555)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 2 07:47:38 PDT 2024
================
@@ -1454,3 +1526,17 @@ VPValue *vputils::getOrCreateVPValueForSCEVExpr(VPlan &Plan, const SCEV *Expr,
Plan.addSCEVExpansion(Expr, Expanded);
return Expanded;
}
+
+bool vputils::isUniformBoolean(VPValue *Cond) {
+ if (match(Cond, m_Not(m_VPValue())))
+ Cond = Cond->getDefiningRecipe()->getOperand(0);
+ auto *R = Cond->getDefiningRecipe();
+ if (!R)
+ return true;
+ // TODO: match additional patterns preserving uniformity of booleans, e.g.,
+ // AND/OR/etc.
+ return match(R, m_Binary<Instruction::ICmp>(m_VPValue(), m_VPValue())) &&
+ all_of(R->operands(), [](VPValue *Op) {
+ return vputils::isUniformAfterVectorization(Op);
----------------
ayalz wrote:
nit: may be simpler the check the two operands of ICmp directly.
https://github.com/llvm/llvm-project/pull/92555
More information about the llvm-commits
mailing list