[llvm] [VPlan] Verify dominance for incoming values of phi-like recipes. (PR #124838)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 16 08:30:19 PST 2025
================
@@ -207,24 +213,69 @@ bool VPlanVerifier::verifyVPBasicBlock(const VPBasicBlock *VPBB) {
for (const VPUser *U : V->users()) {
auto *UI = cast<VPRecipeBase>(U);
- // TODO: check dominance of incoming values for phis properly.
- if (!UI ||
- isa<VPHeaderPHIRecipe, VPWidenPHIRecipe, VPPredInstPHIRecipe>(UI) ||
- (isa<VPIRInstruction>(UI) &&
- isa<PHINode>(cast<VPIRInstruction>(UI)->getInstruction())))
+ const VPBlockBase *UserVPBB = UI->getParent();
+
+ // Verify incoming values of VPIRInstructions wrapping phis. V most
+ // dominate the end of the incoming block. The operand index of the
+ // incoming value matches the predecessor block index of the
+ // corresponding incoming block.
+ if (isVPIRInstructionPhi(*UI)) {
+ for (const auto &[Idx, Op] : enumerate(UI->operands())) {
+ if (V != Op)
+ continue;
----------------
ayalz wrote:
This checks a phi-recipe as a user, coming from every definition reaching it (admittedly expecting only a couple more or less), searching backwards for its index. Would it be better to check phi-recipes upfront, scanning all their operands in order, say as part of `verifyPhiRecipes()`? That would also check live-in operands, although they surely dominate any incoming.
https://github.com/llvm/llvm-project/pull/124838
More information about the llvm-commits
mailing list