[PATCH] D14497: [FunctionAttrs] Detect printf-like functions and propagate readnone+nocapture to variadic operands
James Molloy via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 9 06:15:56 PST 2015
jmolloy created this revision.
jmolloy added reviewers: chandlerc, mcrosier.
jmolloy added a subscriber: llvm-commits.
jmolloy set the repository for this revision to rL LLVM.
If a function is just a wrapper around vsprintf or friends, it neither captures nor writes its arguments.
Because such a function is variadic, we are very conservative about any operand it is called with elsewhere in the compiler, so here if we can we should propagate readnone + nocapture to any operand to the function at all callsites.
In the future this can be extended to other v* functions in the standard library that have defined behavior on their operands, such as vscanf and friends (these do not capture, but do write).
Repository:
rL LLVM
http://reviews.llvm.org/D14497
Files:
lib/Transforms/IPO/FunctionAttrs.cpp
test/Transforms/FunctionAttrs/varargs.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14497.39685.patch
Type: text/x-patch
Size: 6897 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151109/99c53dad/attachment.bin>
More information about the llvm-commits
mailing list