[llvm-commits] [llvm] r93448 - /llvm/trunk/lib/Analysis/InlineCost.cpp

Eric Christopher echristo at apple.com
Thu Jan 14 13:16:48 PST 2010


On Jan 14, 2010, at 12:54 PM, Chris Lattner wrote:

> 
> On Jan 14, 2010, at 12:12 PM, Eric Christopher wrote:
> 
>> +// callIsSmall - If a call will lower to a single selection DAG node, or
>> +// is otherwise deemed small return true.
> 
> "is likely to lower to a single target instruction"
> 
>> +// TODO: Perhaps calls like memcpy, strcpy, etc?
>> +static bool callIsSmall(const Function *F) {
>> +  if (F && !F->hasLocalLinkage() && F->hasName()) {
>> +    StringRef Name = F->getName();
>> +
> 
> Please use early return to avoid nesting this.
> 

Will do :)

> +    // These are all likely to be optimized into something smaller.
> +    if (Name == "pow" || Name == "powf" || Name == "powl" ||
> +        Name == "exp2" || Name == "exp2l" || Name == "exp2f" ||
> +        Name == "floor" || Name == "floorf" || Name == "ceil" ||
> +        Name == "round" || Name == "ffs" || Name == "ffsl" ||
> +        Name == "abs" || Name == "labs" || Name == "llabs")
> 
> exp* and pow* usually don't get inlined, do they?

These are for calls within a function, the idea is that the surrounding
function doesn't get charged full "call" costs for these functions.

Thanks!

-eric



More information about the llvm-commits mailing list