[PATCH] Add a dereferencable attribute

hfinkel at anl.gov hfinkel at anl.gov
Thu Jul 17 22:35:24 PDT 2014


================
Comment at: include/llvm/Bitcode/LLVMBitCodes.h:378
@@ -378,1 +377,3 @@
+    ATTR_KIND_JUMP_TABLE = 40,
+    ATTR_KIND_DEFERERENCEABLE = 41
   };
----------------
Jan Voung wrote:
> DEFERERENCEABLE -> DEREFERENCEABLE ?
Indeed :-)

================
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
----------------
Jan Voung wrote:
> JF Bastien wrote:
> > 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.
> I think the enum in the bitc:: namespace is the one that affects serialized bitcode and not this enum?
Correct, the bitc:: ones are encoded.

================
Comment at: lib/IR/Attributes.cpp:93
@@ +92,3 @@
+                                                uint64_t Bytes) {
+  assert(Bytes && "Bytes must be positive.");
+  return get(Context, Dereferenceable, Bytes);
----------------
JF Bastien wrote:
> Math bikeshed: "non-zero" seems better than "positive".
Agreed (the number is unsigned).

http://reviews.llvm.org/D4449






More information about the llvm-commits mailing list