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.


define void @sle(i8* %p, i32 %a, i32 %b) {
%i.04 = phi i32 [ %a, ], [ %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, the range for LHS is corrected to [INT32_MIN+1, INT32_MIN).

This patch is based on the fixed range in 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 is reverted, need to fix that firstly.