[PATCH] D65262: [SCEV] simplify more icmps with pred sle/ule to pred slt/ult
ChenZheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 24 23:42:43 PDT 2019
shchenz created this revision.
shchenz added reviewers: nikic, sanjoy, hfinkel, reames, jsji.
Herald added subscribers: llvm-commits, wuzish, javed.absar, MaskRay, hiraditya, nemanjai.
Herald added a project: LLVM.
define void @sle(i8* %p, i32 %a, i32 %b) {
...
for.body:
%i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ]
%inc = add nsw i32 %i.04, 1
%cmp = icmp sle i32 %inc, %b
br i1 %cmp, label %for.body, label %for.end
...
}
SCEV for `add` is `{%a, +, 1}`, SCEV for `icmp` LHS is `{(%a + 1) <nsw>, + , 1}`. Currently, the range for LHS is full-set.
In patch https://reviews.llvm.org/D64869, the range for LHS is corrected to `[INT32_MIN+1, INT32_MIN)`.
This patch is based on the fixed range in https://reviews.llvm.org/D64869 to get `backedge-taken` for more loops. We can convert more `sle/ule` to `slt/ult`.
https://reviews.llvm.org/D65262
Files:
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/test/Analysis/ScalarEvolution/trip-count15.ll
llvm/test/CodeGen/PowerPC/ctrloop-le.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65262.211674.patch
Type: text/x-patch
Size: 7646 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190725/aa899522/attachment.bin>
More information about the llvm-commits
mailing list