[llvm] [VPlan] Fold common edges away in convertPhisToBlends (PR #150368)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 24 05:17:48 PDT 2025
================
@@ -227,6 +232,20 @@ void VPPredicator::createSwitchEdgeMasks(VPInstruction *SI) {
setEdgeMask(Src, DefaultDst, DefaultMask);
}
+VPValue *VPPredicator::findCommonEdgeMask(const VPWidenPHIRecipe *PhiR) const {
+ using namespace llvm::VPlanPatternMatch;
+ VPValue *EdgeMask = getEdgeMask(PhiR->getIncomingBlock(0), PhiR->getParent());
+ VPValue *CommonEdgeMask;
+ if (!EdgeMask ||
+ !match(EdgeMask, m_LogicalAnd(m_VPValue(CommonEdgeMask), m_VPValue())))
+ return nullptr;
+ for (unsigned In = 1; In < PhiR->getNumIncoming(); In++)
+ if (!match(getEdgeMask(PhiR->getIncomingBlock(In), PhiR->getParent()),
----------------
lukel97 wrote:
I think either the edge masks all have to be nullptr, or none of them can be, if I'm reading the existing assertion on lines 267-271 correctly?
So here we return early if the first edge mask is null, so from here on out they should be non-null
https://github.com/llvm/llvm-project/pull/150368
More information about the llvm-commits
mailing list