[PATCH] D16205: ValueTracking: Put DataLayout reference into the Query structure, NFC.

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 15 13:26:12 PST 2016


MatzeB added a comment.

In http://reviews.llvm.org/D16205#327475, @reames wrote:

> I have no objection to the patch, but I am curious to know why you see a 
>  speedup here.  I'd really expect a combination of inlining and register 
>  allocation tricks* to cut the cost of the argument passing to near 
>  zero.  If it isn't, that seems like something we should fix in the 
>  compiler.  (I'm assuming you're compiling with a recent Clang here?)
>
> - In many of these cases, the argument register doesn't need to be preserved over the inner call because a) it's not a callee saved register and b) it's not used after the return.
>
>   Have you looked at the resulting assembly to see where the time is spent?


I looked at it a bit in valgrind/callgrind. There are indeed 0.7% less instructions executed overall.
Looking at the assembly the DataLayout parameter is spilled at the beginning of each function and reloaded in front of nearly all recursive calls. According to valgrind this saves 2-3% of instructions in the various computeKnownBits functions and surprisingly they are high enough in the profile that this amounts to 0.7% instructions saved overall.


Repository:
  rL LLVM

http://reviews.llvm.org/D16205





More information about the llvm-commits mailing list