diff options
author | Florian Hahn <flo@fhahn.com> | 2021-06-25 09:29:47 +0100 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2021-06-25 10:24:40 +0100 |
commit | 6478f3fb78b3e7cddb642dce0f39d5d4a976af1e (patch) | |
tree | 3644f0808e6155220a33b7b0b25994478d4747aa /flang/lib/Frontend/CompilerInvocation.cpp | |
parent | 7206ad04d585fd5300020f883debaef4429e03ee (diff) | |
download | llvm-6478f3fb78b3e7cddb642dce0f39d5d4a976af1e.zip llvm-6478f3fb78b3e7cddb642dce0f39d5d4a976af1e.tar.gz llvm-6478f3fb78b3e7cddb642dce0f39d5d4a976af1e.tar.bz2 |
[SCEV] Support single-cond range check idiom in applyLoopGuards.
This patch extends applyLoopGuards to detect a single-cond range check
idiom that InstCombine generates.
It extends applyLoopGuards to detect conditions of the form
(-C1 + X < C2). InstCombine will create this form when combining two
checks of the form (X u< C2 + C1) and (X >=u C1).
In practice, this enables us to correctly compute a tight trip count
bounds for code as in the function below. InstCombine will fold the
minimum iteration check created by LoopRotate with the user check (< 8).
void unsigned_check(short *pred, unsigned width) {
if (width < 8) {
for (int x = 0; x < width; x++)
pred[x] = pred[x] * pred[x];
}
}
As a consequence, LLVM creates dead vector loops for the code above,
e.g. see https://godbolt.org/z/cb8eTcqET
https://alive2.llvm.org/ce/z/SHHW4d
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D104741
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions