This is an archive of the discontinued LLVM Phabricator instance.

NFC. Introduce Value::getPointerDerferecnceableBytes.
ClosedPublic

Authored by apilipenko on Feb 24 2016, 7:17 AM.

Details

Summary

Extract a part of isDereferenceableAndAlignedPointer functionality to Value::getPointerDerferecnceableBytes. Currently it's a NFC, but in future I'm going to accumulate all the logic about value dereferenceability in this function similarly to Value::getPointerAlignment function (D16144).

Diff Detail

Event Timeline

apilipenko updated this revision to Diff 48933.Feb 24 2016, 7:17 AM
apilipenko retitled this revision from to NFC. Introduce Value::getPointerDerferecnceableBytes..
apilipenko updated this object.
apilipenko added reviewers: hfinkel, reames.
apilipenko added a subscriber: llvm-commits.
apilipenko updated this revision to Diff 48937.Feb 24 2016, 7:26 AM

Add an assert that the value is a pointer.

reames accepted this revision.Mar 17 2016, 7:07 PM
reames edited edge metadata.

LGTM w/minor comment addressed.

include/llvm/IR/Value.h
507

This part of the comment is unclear. Can you reword?

lib/IR/Value.cpp
522

As a separate patch, I think it would make sense to just kill the CanBeNull bit entirely. The cases where we can not check for null are also ones isKnownNonNull can trivially return true for.

This revision is now accepted and ready to land.Mar 17 2016, 7:07 PM
This revision was automatically updated to reflect the committed changes.