aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
diff options
context:
space:
mode:
authorDavid Sherwood <david.sherwood@arm.com>2024-09-19 09:41:25 +0100
committerGitHub <noreply@github.com>2024-09-19 09:41:25 +0100
commite762d4dac762a3fc27c6e251086b6645d7543bb2 (patch)
tree67b2d159525f3026a211e094ca44108e9e91b0d9 /llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
parent60a8b2b1d0842e257e2add6fb1b27cf45699b641 (diff)
downloadllvm-e762d4dac762a3fc27c6e251086b6645d7543bb2.zip
llvm-e762d4dac762a3fc27c6e251086b6645d7543bb2.tar.gz
llvm-e762d4dac762a3fc27c6e251086b6645d7543bb2.tar.bz2
[LoopVectorize] Teach LoopVectorizationLegality about more early exits (#107004)
This patch is split off from PR #88385 and concerns only the code related to the legality of vectorising early exit loops. It is the first step in adding support for vectorisation of a simple class of loops that typically involves searching for something, i.e. for (int i = 0; i < n; i++) { if (p[i] == val) return i; } return n; or for (int i = 0; i < n; i++) { if (p1[i] != p2[i]) return i; } return n; In this initial commit LoopVectorizationLegality will only consider early exit loops legal for vectorising if they follow these criteria: 1. There are no stores in the loop. 2. The loop must have only one early exit like those shown in the above example. I have referred to such exits as speculative early exits, to distinguish from existing support for early exits where the exit-not-taken count is known exactly at compile time. 3. The early exit block dominates the latch block. 4. The latch block must have an exact exit count. 5. There are no loads after the early exit block. 6. The loop must not contain reductions or recurrences. I don't see anything fundamental blocking vectorisation of such loops, but I just haven't done the work to support them yet. 7. We must be able to prove at compile-time that loops will not contain faulting loads. Tests have been added here: Transforms/LoopVectorize/AArch64/simple_early_exit.ll
Diffstat (limited to 'llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp')
0 files changed, 0 insertions, 0 deletions