[PATCH] InstCombine: propagate deref via new addDereferenceableAttr

Philip Reames listmail at philipreames.com
Mon Feb 9 13:46:46 PST 2015


General direction seems fine.  I can't comment on the attribute set stuff (I've never taken the time to understand it), maybe Hal can?


================
Comment at: lib/Transforms/InstCombine/InstCombineCalls.cpp:1139
@@ +1138,3 @@
+    if (DerivedPtr->isDereferenceablePointer(DL)) {
+      uint64_t Bytes = cast<Argument>(DerivedPtr)->getDereferenceableBytes();
+      II->addDereferenceableAttr(AttributeSet::ReturnIndex, Bytes);
----------------
This cast is not safe.  Dereferencabble pointers can come from other sources (e.g. calls) as well.

http://reviews.llvm.org/D7510

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






More information about the llvm-commits mailing list