[PATCH] D17611: NFC. Introduce Value::isPointerDereferenceable

Artur Pilipenko via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 27 09:52:09 PDT 2016


On 27 Apr 2016, at 17:33, David Majnemer <david.majnemer at gmail.com<mailto:david.majnemer at gmail.com>> wrote:



On Wed, Apr 27, 2016 at 6:48 AM, Artur Pilipenko <apilipenko at azulsystems.com<mailto:apilipenko at azulsystems.com>> wrote:
apilipenko added inline comments.

================
Comment at: lib/IR/Value.cpp:556
@@ -555,1 +555,3 @@

+bool Value::isPointerDereferenceable(bool &CanBeNull) const {
+  assert(getType()->isPointerTy() && "must be pointer");
----------------
majnemer wrote:
> I'd expect this to call isDereferenceableFromAttribute.
Can you elaborate? isDereferenceableFromAttribute is an internal function in Loads.cpp, while this is a public API to get inherent property of the value.

There is no inherent reason why isPointerDereferenceable _must_ be a member of Value, it is quite reasonable for it to be exposed in Loads.h seeing as how it seems quite similar to isSafeToLoadUnconditionally.
Loads.h provides isDereferenceableAndAligned API which looks through casts/relocations, performs context sensitive nullness analysis, verifies alignment. The function I introduce provides base facts for isDereferenceableAndAligned analysis.



http://reviews.llvm.org/D17611





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160427/23aecf43/attachment.html>


More information about the llvm-commits mailing list