[llvm] [LV] Vectorize early exit loops with multiple exits. (PR #174864)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 16 07:33:43 PST 2026


================

----------------
fhahn wrote:

Thanks, I split off the changes to LoopVectorizationLegality to https://github.com/llvm/llvm-project/pull/176403 and updated this PR to include it for now

I tried to also separate the changes for only constant live-outs, but I couldn't find a way to really come up with a simpler patch, as  it would only impact the code below, and we would still need that to handle the single-early-exit case. We  could add a separate code path, , but we would still need to iterate over all exiting blocks to patch up the live-outs.

```      if (!isa<VPIRValue>(IncomingVal)) {
        VPBuilder EarlyExitB(VectorEarlyExitVPBB);
        NewIncoming = EarlyExitB.createNaryOp(
            VPInstruction::ExtractLane, {&FirstActiveLane, IncomingVal},
            DebugLoc::getUnknown(), "early.exit.value");
      }
```

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


More information about the llvm-commits mailing list