Page MenuHomePhabricator

[SCEV] simplify more icmps with pred sle/ule to pred slt/ult
Changes PlannedPublic

Authored by shchenz on Jul 24 2019, 11:42 PM.

Details

Summary
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 %i.04 is {%a, +, 1}, SCEV for icmp LHS(%inc) 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.

Diff Detail

Event Timeline

shchenz created this revision.Jul 24 2019, 11:42 PM
shchenz edited the summary of this revision. (Show Details)Jul 25 2019, 1:39 AM
shchenz planned changes to this revision.Mon, Oct 7, 6:52 PM

https://reviews.llvm.org/D64868 is reverted, need to fix that firstly.