This is an archive of the discontinued LLVM Phabricator instance.

Dereferenceable, dereferenceable_or_null metadata for loads
ClosedPublic

Authored by apilipenko on Apr 30 2015, 3:08 AM.

Details

Summary

Introduce dereferenceable, dereferenceable_or_null metadata for loads with the same semantic as corresponding attributes.

This patch depends on http://reviews.llvm.org/D9253

Diff Detail

Repository
rL LLVM

Event Timeline

apilipenko updated this revision to Diff 24689.Apr 30 2015, 3:08 AM
apilipenko retitled this revision from to Dereferenceable, dereferenceable_or_null metadata for loads.
apilipenko updated this object.
apilipenko edited the test plan for this revision. (Show Details)
apilipenko added reviewers: hfinkel, reames, sanjoy.
apilipenko added a subscriber: Unknown Object (MLST).
reames edited edge metadata.May 5 2015, 4:24 PM

Code wise, looks fine. The tests need a bit more coverage and you need to update the LangRef. Once that's done, should be easy to do a final signoff.

Although, am I correct in believing your second test is dependent on your LICM changes? If so, you might want to separate that test case for the moment. I suspect this patch will be landing first.

test/Analysis/ValueTracking/memory-dereferenceable.ll
32 ↗(On Diff #24689)

I'd really like to see some more exhaustive testing here. Cases to cover include:
load from an offset not covered by the dereferenceable portion
load from a potentially null point with dereferenceable_or_null
load from a non-null pointer with dereferenceable_or_null (i.e. pointer has nonnull metadata as well)

reames requested changes to this revision.May 5 2015, 4:24 PM
reames edited edge metadata.
This revision now requires changes to proceed.May 5 2015, 4:24 PM
apilipenko updated this revision to Diff 25179.May 7 2015, 7:15 AM
apilipenko edited edge metadata.

LangRef updated, more tests added.

ValueTracking part is also dependant on LICM changes. So I plan to integrate it after the LICM patch.

reames accepted this revision.May 11 2015, 1:28 PM
reames edited edge metadata.

LGTM

This revision is now accepted and ready to land.May 11 2015, 1:28 PM
sanjoy accepted this revision.May 18 2015, 10:46 AM
sanjoy edited edge metadata.

Minor comment inline for post-commit review.

lib/Analysis/ValueTracking.cpp
2880 ↗(On Diff #24689)

In both the places, instead of doing

MDNode *MD = ...
if (MD)

you can do

if (MDNode *MD = ...)

This does not apply cleanly after applying D9253 -- I'll check in D9253 shortly, can you rebase on master once I have done that?

apilipenko updated this revision to Diff 26065.May 19 2015, 8:35 AM
apilipenko edited edge metadata.

Rebased version.

This revision was automatically updated to reflect the committed changes.