This is an archive of the discontinued LLVM Phabricator instance.

[LVI] Take range metadata into account while calculating icmp condition constraints
ClosedPublic

Authored by apilipenko on Aug 8 2016, 8:29 AM.

Details

Summary

Take range metadata into account for conditions like this:

%length = load i32, i32* %length_ptr, !range !{i32 0, i32 2147483647}
%cmp = icmp ult i32 %a, %length

This is a common pattern for range checks where the length of the array is dynamically loaded.

Diff Detail

Event Timeline

apilipenko updated this revision to Diff 67174.Aug 8 2016, 8:29 AM
apilipenko retitled this revision from to [LVI] Take range metadata into account while calculating icmp condition constraints.
apilipenko updated this object.
apilipenko added a reviewer: sanjoy.
apilipenko updated this object.
apilipenko added a subscriber: llvm-commits.
sanjoy accepted this revision.Aug 8 2016, 10:09 AM
sanjoy edited edge metadata.

lgtm

test/Transforms/CorrelatedValuePropagation/range.ll
460

Phabricator says there's a missing newline at the end of this file.

This revision is now accepted and ready to land.Aug 8 2016, 10:09 AM
This revision was automatically updated to reflect the committed changes.