[PATCH] D18656: [SimplifyLibCalls] Strip dead code in printf() transformations

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 31 11:03:33 PDT 2016


spatel added inline comments.

================
Comment at: lib/Transforms/Utils/SimplifyLibCalls.cpp:1828-1832
@@ -1827,7 +1827,7 @@
 
   // Do not do any of the following transformations if the printf return value
   // is used, in general the printf return value is not compatible with either
   // putchar() or puts().
   if (!CI->use_empty())
     return nullptr;
 
----------------
IMO, the asserts are unnecessary since the check for empty is right here and has a nice explanatory comment too.

If others like the added safety of the asserts, I don't object. There is a proposal to refactor this whole file, so maybe asserts will be handy.

But instead of repeating the assert 5x, add a one-line helper function or lambda?


http://reviews.llvm.org/D18656





More information about the llvm-commits mailing list