[PATCH] D49809: [InstCombine] Unlocked IO transformation - off by default

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 25 11:27:08 PDT 2018


xbolva00 added a comment.

I sent it under r332452 but anyway..

Typical case is

void log(data) {

   file = fopen(....)
   for (...) 
       fwrite(data ..)
  ... maybe some more logging ...
  close(file);

} // cond: file does not escape

Here we replace e.g. fwrite (in this example) (which needs to lock and unlock internal lock to be thread safe) with fwrite_unlocked which does not do expensive lock/unlock. 
I tried several small open source projects and I got several hits.

- What does the typical improvement look like? Avoid useless locking in I/O functions, faster output to files.
- What do you think the policy should be for simplifying libcalls in a way that can break interceptors?

-> off by default + option to enable. Maybe interceptors can be extended in the future to handle this transformation/function calls?

Any ideas for option name? Is this one ok?


Repository:
  rL LLVM

https://reviews.llvm.org/D49809





More information about the llvm-commits mailing list