[PATCH] Add a dereferencable attribute

JF Bastien jfb at chromium.org
Fri Jul 11 10:59:06 PDT 2014

Looks good to me, besides two small comments.

Comment at: include/llvm/IR/Attributes.h:91
@@ -90,2 +90,3 @@
     NonNull,               ///< Pointer is known to be not null
+    Dereferenceable,       ///< Pointer is known to be dereferenceable
     NoRedZone,             ///< Disable redzone
You'll make some people sad (not PNaCl, but Renderscript and others) by adding the attribute here in the enum instead of at the end, since it changes bitcode slightly.

Comment at: lib/IR/Attributes.cpp:93
@@ +92,3 @@
+                                                uint64_t Bytes) {
+  assert(Bytes && "Bytes must be positive.");
+  return get(Context, Dereferenceable, Bytes);
Math bikeshed: "non-zero" seems better than "positive".


More information about the llvm-commits mailing list