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

Chris Lattner clattner at apple.com
Fri Jan 23 23:00:18 PST 2009


On Jan 23, 2009, at 5:27 PM, Dale Johannesen wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=62908&view=rev
> Log:
> Improve the inlining cost function a bit.
> Little practical effect.

Hi Dale,

Please use NumInsts += CS.arg_size();  instead of a loop.

Thanks!

-Chris

>
>
>
> Modified:
>    llvm/trunk/lib/Transforms/Utils/InlineCost.cpp
>
> Modified: llvm/trunk/lib/Transforms/Utils/InlineCost.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineCost.cpp?rev=62908&r1=62907&r2=62908&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/Transforms/Utils/InlineCost.cpp (original)
> +++ llvm/trunk/lib/Transforms/Utils/InlineCost.cpp Fri Jan 23  
> 19:27:33 2009
> @@ -121,9 +121,12 @@
>           }
>
>         // Calls often compile into many machine instructions.  Bump  
> up their
> -        // cost to reflect this.
> -        if (!isa<IntrinsicInst>(II))
> -          NumInsts += 5;
> +        // cost to reflect this.  Allow an extra instruction per  
> parameter.
> +        if (!isa<IntrinsicInst>(II)) {
> +          for (CallSite::arg_iterator I = CS.arg_begin(), E =  
> CS.arg_end();
> +               I != E; ++I)
> +            NumInsts ++;
> +        }
>       }
>
>       if (const AllocaInst *AI = dyn_cast<AllocaInst>(II)) {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list