This is an archive of the discontinued LLVM Phabricator instance.

Use ScalarEvolution to create tight bounds on the parameters
ClosedPublic

Authored by jdoerfert on Feb 12 2015, 12:03 AM.

Diff Detail

Event Timeline

jdoerfert updated this revision to Diff 19808.Feb 12 2015, 12:03 AM
jdoerfert retitled this revision from to Use ScalarEvolution to create tight bounds on the parameters.
jdoerfert added subscribers: Restricted Project, Unknown Object (MLST).
grosser accepted this revision.Feb 18 2015, 12:16 PM
grosser edited edge metadata.

Hi Johannes,

this patch LGTM besides two minor comments:

  1. The LLVM language reference says "The range is allowed to wrap."

In case the lower bound is larger than the upper bound (e.g. [10, 5) we would add constraints p >= 10 && p < 5. However, this should rather be p >= 10 || p < 5.

  1. Add a comment that this change exploits LLVM's range metadata to the commit message

Sebastian pointed out that from a look at the commit message or the test case it is not immediately clear where the information about the bounded range of p is derived from. It would be nice to point this out in the commit message.

This revision is now accepted and ready to land.Feb 18 2015, 12:16 PM
sebpop edited edge metadata.Feb 18 2015, 12:34 PM
  1. Add a comment that this change exploits LLVM's range metadata to the commit message

Sebastian pointed out that from a look at the commit message or the test case it is not immediately clear where the information about the bounded range of p is derived from. It would be nice to point this out in the commit message.

I would like the comment to also be included in a comment in the
testcase close by the check line:

+; CHECK: [p_0] -> { : p_0 >= 0 and p_0 <= 255 }

pointing out that the constraint is deduced from the stmt using the
range !0 metadata:

+ %tmp = load i32* %p, align 4, !range !0
+!0 = !{ i32 0, i32 256 }

Thanks,
Sebastian

jdoerfert closed this revision.Feb 23 2015, 8:26 AM

landed in r230230.