llvm / llvm/llvm-project

[LoopVectorize] Implement check-first vectorization with scalar replay

Open
#215,471 0 comments 0 reactions 0 assignees View on GitHub
vectorizers
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Implement the core check-first vectorization strategy for simple loops and loops with cascaded early exits.
The transformation evaluates exit conditions before executing the vectorized loop body. When an exit is detected, execution continues through scalar replay.

High level objectives:
1. Add legality analysis for check-first vectorization.
2. Construct the check-first VPlan.
3. Support single and cascaded exits.
4. Wire early exits to scalar replay.
5. Add the required cost-model changes.
6. Add tests for single exits, cascaded exits, instruction reordering, and state updates.

Depends on [#215468](https://github.com/llvm/llvm-project/issues/215468)

Contributor guide

Open the contributing guide

Research direction

Start by reviewing prerequisite issue #215468, then trace LLVM's legality analysis, VPlan construction, early-exit and scalar-replay handling, and cost-model work. Done means supporting simple loops and cascaded early exits, with tests covering exits, instruction reordering, and state updates.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.