This is an archive of the discontinued LLVM Phabricator instance.

Move Value.isDereferenceablePointer to ValueTracking
ClosedPublic

Authored by apilipenko on Apr 17 2015, 4:45 AM.

Details

Summary

Move isDereferenceablePointer function to Analysis. This function recursively tracks dereferencability over a chain of values like other functions in ValueTracking.

This refactoring is motivated by further changes to support dereferenceable_or_null attribute (http://reviews.llvm.org/D8650). isDereferenceablePointer will be extended to perform context-sensitive analysis and IR is not a good place to have such functionality.

Diff Detail

Event Timeline

apilipenko updated this revision to Diff 23913.Apr 17 2015, 4:45 AM
apilipenko retitled this revision from to Move Value.isDereferenceablePointer to ValueTracking.
apilipenko updated this object.
apilipenko edited the test plan for this revision. (Show Details)
apilipenko added reviewers: reames, sanjoy.
apilipenko added a subscriber: Unknown Object (MLST).
hfinkel accepted this revision.Apr 17 2015, 5:13 AM
hfinkel added a reviewer: hfinkel.
hfinkel added a subscriber: hfinkel.

LGTM.

lib/Transforms/Scalar/SROA.cpp
1410

Taking this opportunity to point out an existing issue:

The fact that we need to call both isDereferenceablePointer and isSafeToLoadUnconditionally here is silly (and implies extra expense, because isSafeToLoadUnconditionally starts by calling GetPointerBaseWithConstantOffset). It would be nice to unify these two pieces of functionality (which are both essentially doing the same thing).

This revision is now accepted and ready to land.Apr 17 2015, 5:13 AM
reames edited edge metadata.Apr 20 2015, 5:26 PM

Artur,

Would you like me to commit on your behalf?

Philip

apilipenko closed this revision.Apr 27 2015, 1:49 AM