[PATCH] [FunctionAttr] Infer nonnull attributes on returns

Nick Lewycky nlewycky at google.com
Mon May 11 20:22:28 PDT 2015


================
Comment at: lib/Transforms/IPO/FunctionAttrs.cpp:858
@@ +857,3 @@
+
+  for (unsigned i = 0; i != FlowsToReturn.size(); ++i) {
+    Value *RetVal = FlowsToReturn[i];
----------------
pete wrote:
> I think this would be better as a worklist you pop values off until its empty.
Be careful not to break the case of resolving a self recursive phi. I think the normal way to handle this is with a set of "visited" elements, plus a worklist "queue" like Pete suggests.

================
Comment at: lib/Transforms/IPO/FunctionAttrs.cpp:920
@@ +919,3 @@
+
+  // Speculative assume that all functions in the SCC return only nonnull
+  // pointers.  We may refute this as we analyze functions.
----------------
"Speculative assume" -> "Speculatively assume" or possibly just "Speculate"

================
Comment at: test/Transforms/FunctionAttrs/nonnull.ll:61
@@ +60,3 @@
+
+
+; Local analysis, but going through a self recursive phi
----------------
Extra newline.

http://reviews.llvm.org/D9688

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






More information about the llvm-commits mailing list