[IR] Introduce a dereferenceable_or_null(N) attribute.
[oota-llvm.git] / lib / IR / Function.cpp
index 8275cc692a66a4bf33b30a3f74584134e520e595..d3a09348220306de98457551dcdd5aa47c3540d9 100644 (file)
@@ -348,6 +348,12 @@ void Function::addDereferenceableAttr(unsigned i, uint64_t Bytes) {
   setAttributes(PAL);
 }
 
+void Function::addDereferenceableOrNullAttr(unsigned i, uint64_t Bytes) {
+  AttributeSet PAL = getAttributes();
+  PAL = PAL.addDereferenceableOrNullAttr(getContext(), i, Bytes);
+  setAttributes(PAL);
+}
+
 // Maintain the GC name for each function in an on-the-side table. This saves
 // allocating an additional word in Function for programs which do not use GC
 // (i.e., most programs) at the cost of increased overhead for clients which do