[PATCH] InstCombine: propagate deref and nonNull return attributes

hfinkel at anl.gov hfinkel at anl.gov
Fri Feb 6 14:48:17 PST 2015


In http://reviews.llvm.org/D7107#119587, @artagnon wrote:

> ping! (How) should I write a test for this?


I think you'd add tests for the nonnull attribute in a similar way to how we test for the nonnull metadata in test/Transforms/InstCombine/assume.ll.


================
Comment at: lib/Transforms/InstCombine/InstCombineCalls.cpp:1137
@@ -1130,1 +1136,3 @@
+    if (DerivedPtr->isDereferenceablePointer())
+      II->addAttribute(AttributeSet::ReturnIndex, Attribute::Dereferenceable);
 
----------------
This does not seem right. dereferenceable needs a size.

http://reviews.llvm.org/D7107

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list