[llvm-commits] [llvm-gcc-4.2] r55718 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp

Evan Cheng evan.cheng at apple.com
Wed Sep 3 23:01:57 PDT 2008


Does this mean we can stop using gcc's trivial inliner?

Evan

On Sep 3, 2008, at 1:01 PM, Devang Patel wrote:

> Author: dpatel
> Date: Wed Sep  3 15:01:27 2008
> New Revision: 55718
>
> URL: http://llvm.org/viewvc/llvm-project?rev=55718&view=rev
> Log:
> Use AlwaysInliner to handle always_inline functions, if regular  
> inliner is not used.
>
>
> Modified:
>    llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
>
> Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=55718&r1=55717&r2=55718&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
> +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Wed Sep  3 15:01:27 2008
> @@ -388,6 +388,19 @@
>       PM->add(createPruneEHPass());               // Remove dead EH  
> info
>     if (flag_inline_trees > 1)                  // respect -fno- 
> inline-functions
>       PM->add(createFunctionInliningPass());    // Inline small  
> functions
> +    else {
> +      // The inliner pass won't be inserted based on command line  
> options.
> +      // Use AlwaysInliner to handle functions that are marked as  
> always_inline.
> +      bool NeedAlwaysInliner = false;
> +      for (Module::iterator I = TheModule->begin(), E = TheModule- 
> >end();
> +         I != E; ++I)
> +        if (!I->isDeclaration() && I->getNotes() ==  
> FN_NOTE_AlwaysInline) {
> +          NeedAlwaysInliner = true;
> +          break;
> +        }
> +      if (NeedAlwaysInliner)
> +        PM->add(createAlwaysInlinerPass());
> +    }
>     if (optimize > 2)
>       PM->add(createArgumentPromotionPass());   // Scalarize  
> uninlined fn args
>     if (!flag_no_simplify_libcalls)
> @@ -431,7 +444,7 @@
>     if (optimize > 1 && flag_unit_at_a_time)
>       PM->add(createConstantMergePass());       // Merge dup global  
> constants
>   }
> -
> +
>   if (emit_llvm_bc) {
>     // Emit an LLVM .bc file to the output.  This is used when passed
>     // -emit-llvm -c to the GCC driver.
>
>
> _______________________________________________
> 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