[PATCH] D14497: [FunctionAttrs] Detect printf-like functions and propagate readnone+nocapture to variadic operands

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 13 11:15:11 PST 2015


majnemer added a comment.

If I am not mistaken, these functions may capture the variadic arguments in Glibc environments via `register_printf_specifier` and `register_printf_function`.  Personally, I'd sleep fine at night if we assumed that registered handler functions cannot capture or store to the arguments.


================
Comment at: lib/Transforms/IPO/FunctionAttrs.cpp:876-879
@@ +875,6 @@
+            }
+            if (!CI->paramHasAttr(I, Attribute::ReadOnly)) {
+              Changed = true;
+              CI->addAttribute(I, Attribute::ReadOnly);
+            }
+          }
----------------
Your description says `ReadNone` but the code says `ReadOnly`.


Repository:
  rL LLVM

http://reviews.llvm.org/D14497





More information about the llvm-commits mailing list