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

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Dec 21 13:05:23 PST 2011


On Dec 21, 2011, at 12:26 PM, Nick Lewycky wrote:

> Author: nicholas
> Date: Wed Dec 21 14:26:03 2011
> New Revision: 147093
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=147093&view=rev
> Log:
> Continue counting intrinsics as instructions (except when they aren't, such as
> debug info) and for being vector operations. Fixes regression from r147037.

Looks good. Thanks!

/jakob


> 
> Modified:
>    llvm/trunk/lib/Analysis/InlineCost.cpp
> 
> Modified: llvm/trunk/lib/Analysis/InlineCost.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InlineCost.cpp?rev=147093&r1=147092&r2=147093&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Analysis/InlineCost.cpp (original)
> +++ llvm/trunk/lib/Analysis/InlineCost.cpp Wed Dec 21 14:26:03 2011
> @@ -63,8 +63,22 @@
> 
>     // Special handling for calls.
>     if (isa<CallInst>(II) || isa<InvokeInst>(II)) {
> -      if (isa<IntrinsicInst>(II))
> -        continue;  // Intrinsics have no argument setup and can't be inlined.
> +      if (const IntrinsicInst *IntrinsicI = dyn_cast<IntrinsicInst>(II)) {
> +        switch (IntrinsicI->getIntrinsicID()) {
> +        default: break;
> +        case Intrinsic::dbg_declare:
> +        case Intrinsic::dbg_value:
> +        case Intrinsic::invariant_start:
> +        case Intrinsic::invariant_end:
> +        case Intrinsic::lifetime_start:
> +        case Intrinsic::lifetime_end:
> +        case Intrinsic::objectsize:
> +        case Intrinsic::ptr_annotation:
> +        case Intrinsic::var_annotation:
> +          // These intrinsics don't count as size.
> +          continue;
> +        }
> +      }
> 
>       ImmutableCallSite CS(cast<Instruction>(II));
> 
> @@ -83,7 +97,7 @@
>           isRecursive = true;
>       }
> 
> -      if (!callIsSmall(CS.getCalledFunction())) {
> +      if (!isa<IntrinsicInst>(II) && !callIsSmall(CS.getCalledFunction())) {
>         // Each argument to a call takes on average one instruction to set up.
>         NumInsts += CS.arg_size();
> 
> 
> 
> _______________________________________________
> 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