This is an archive of the discontinued LLVM Phabricator instance.

[SCEV] Improve Scalar Evolution's use of no {un,}signed wrap flags
ClosedPublic

Authored by bsmith on Oct 27 2014, 9:09 AM.

Details

Reviewers
bsmith
atrick
Summary

In a case where we have a no {un,}signed wrap flag on the increment of a loop and
RHS - Start is constant then we can avoid inserting a max operation between
the two, since we can statically determine which is greater.

This allows us to unroll loops such as:

void testcase3(int v) {
  for (int i=v; i<=v+1; ++i)
    f(i);
}

This patch implements this optimization.

Diff Detail

Event Timeline

bsmith updated this revision to Diff 15495.Oct 27 2014, 9:09 AM
bsmith retitled this revision from to [SCEV] Improve Scalar Evolution's use of no {un,}signed wrap flags.
bsmith updated this object.
bsmith edited the test plan for this revision. (Show Details)
bsmith set the repository for this revision to rL LLVM.
bsmith added a subscriber: Unknown Object (MLST).

Hi Bradley,

Looks good, but I'm no expert in the scalar evolution, so I'll let others approve your patch.

cheers,
--renato

hfinkel added a subscriber: hfinkel.

Please post patches will full context, see http://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface for more information.

(also, adding Andy)

bsmith updated this revision to Diff 15562.Oct 30 2014, 3:44 AM

Add context to patch. Apologies, I'd totally forgotten about doing this!

LGTM.

Thanks.

lib/Analysis/ScalarEvolution.cpp
6971

s/operaions/operation/

7052

s/operaions/operation/

Committed as 220960, thanks!

bsmith accepted this revision.Oct 31 2014, 4:52 AM
bsmith added a reviewer: bsmith.
This revision is now accepted and ready to land.Oct 31 2014, 4:52 AM
bsmith closed this revision.Oct 31 2014, 4:52 AM
sanjoy added a subscriber: sanjoy.Jun 17 2016, 9:53 PM

Hi,

I've had to (effectively) revert this change in http://reviews.llvm.org/rL273079. I don't think it does the right thing in the test cases checked in with http://reviews.llvm.org/rL273079, please take a look.