[PATCH] [RFC] __builtin___clear_cache support in LLVM

Renato Golin renato.golin at linaro.org
Sat Mar 15 02:59:07 PDT 2014

  Thanks JF!


  Regarding optimization, I think having the intrinsic will help removing it when the memory operations regarding that region in memory go away. If we treat that as a function call, we can't remove because we can't prove there is no side effect (well, there isn't), but since it's a builtin, we know that it only needs to run if the preceding writes change that range in memory. This is specially true when inlining reveals patterns about memory access.

  Another optimization would be to common up several calls to __clear_cache in one big, for instance, in a loop with sequential access. Again, inlining might prove the induction variable joins the ranges, and, if no other reads from that memory are necessary, you can only emit one call at the end.

  Since __clear_cache is a huge hit in performance, and since low level drivers are the ones most likely to be implementing them, it may have an overall impact in other user code as well, especially on embedded platforms (ARM, MIPS).



More information about the llvm-commits mailing list