[llvm-commits] [llvm] r76285 - /llvm/trunk/lib/Transforms/Utils/InlineCost.cpp

Chris Lattner clattner at apple.com
Sat Jul 18 11:51:48 PDT 2009


On Jul 17, 2009, at 11:40 PM, Eli Friedman wrote:
>> This is a great catch.  However, one case that is important to get is
>> "load <ptr>" where ptr is a (constant) pointer to a constant global.
>> This can lead to serious shrinkage :)
>>
>> -Chris
>
> It doesn't look trivial to implement, so I filed it as PR4574.

Aha, I forgot that we don't have the constant actually being  
substituted into the code.  While the nice "caching" approach to  
computing the inlining shrinkage is useful, it would be nice to have a  
more accurate model that actually looks at one specific call site and  
propagates a specific set of constant arguments.  This would allow a  
much more accurate model for the shrinkage and would be allow us to be  
able to tell that something like:

void foo(int x, int y) {
    int t = x+y;
   ...

that "t" is a constant if both x and y are constants.  It would also  
let us know which arm of a switch is reached (for more accurate code  
size estimates), etc.

-Chris




More information about the llvm-commits mailing list