[llvm] [LoopVectorize] Enable vectorisation of early exit loops with live-outs (PR #120567)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 13:14:13 PST 2025


================
@@ -212,7 +212,11 @@ bool VPlanVerifier::verifyVPBasicBlock(const VPBasicBlock *VPBB) {
           continue;
         }
 
-        if (!VPDT.dominates(VPBB, UI->getParent())) {
+        // Now that we support vectorising loops with uncountable early exits
+        // we can end up in situations where VPBB does not dominate the exit
+        // block. Only do the check if the user is not in a VPIRBasicBlock.
+        if (!isa<VPIRBasicBlock>(UI->getParent()) &&
+            !VPDT.dominates(VPBB, UI->getParent())) {
----------------
fhahn wrote:

I see; IIUC whether a block has multiple predecessors or not shouldn't really be the issue. The problem is that for a phi we need to check if the incoming value dominates the incoming block. 

We have the same issue for other phi-like recipes, see TODO above (line 210). I think it should be sufficient to skip VPIRInstructions wrapping a phi instruction there as well?

That way we would preserve def-use checks for other recipes in VPIRBasicBlocks.

I also put up https://github.com/llvm/llvm-project/pull/124838 separately to extend def-use verification to phis, which should enable removing the early continue in all cases

https://github.com/llvm/llvm-project/pull/120567


More information about the llvm-commits mailing list