[LoopVectorize] Implement masked replay for check-first vectorization
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Add masked replay as an alternative to scalar replay for eligible check-first-vectorized loops.
Masked replay executes only the required operations and lanes after an early exit, avoiding scalar replay when it is safe to do so.
High level objectives:
1. Determine when masked replay can be used.
2. Generate masks for stores that must be replayed.
3. Combine replay masks with existing store guards.
4. Wire masked replay to the appropriate early-exit block.
5. Integrate the transformation into the VPlan optimization pipeline.
6. Add tests for masked replay with nested and guarded exits.
Depends on [#215472](https://github.com/llvm/llvm-project/issues/215472)
Contributor guide
Research direction
Start by reading the existing LoopVectorize and VPlan optimization pipeline, and review dependency #215472 before defining the masked-replay eligibility rules. Trace the early-exit and store-guard handling, then add coverage for nested and guarded exits. Done means masked replay is selected safely, generates and combines the required masks, reaches the appropriate early-exit block, and passes the new tests.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100