[llvm-commits] [llvm-gcc-4.2] r51257 - in /llvm-gcc-4.2/trunk/gcc: cgraphunit.c ipa-inline.c passes.c

Duncan Sands baldrick at free.fr
Mon May 19 09:42:57 PDT 2008


Author: baldrick
Date: Mon May 19 11:42:56 2008
New Revision: 51257

URL: http://llvm.org/viewvc/llvm-project?rev=51257&view=rev
Log:
Inline functions marked always_inline, but otherwise
don't do any inlining if building with LLVM support.
This fixes always_inline when using -funit-at-a-time.

Modified:
    llvm-gcc-4.2/trunk/gcc/cgraphunit.c
    llvm-gcc-4.2/trunk/gcc/ipa-inline.c
    llvm-gcc-4.2/trunk/gcc/passes.c

Modified: llvm-gcc-4.2/trunk/gcc/cgraphunit.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cgraphunit.c?rev=51257&r1=51256&r2=51257&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cgraphunit.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cgraphunit.c Mon May 19 11:42:56 2008
@@ -1614,13 +1614,9 @@
       dump_cgraph (cgraph_dump_file);
     }
     
-  /* LLVM local begin */
-#ifndef ENABLE_LLVM
   /* Don't run the IPA passes if there was any error or sorry messages.  */
   if (errorcount == 0 && sorrycount == 0)
     ipa_passes ();
-#endif
-  /* LLVM local end */
 
   /* This pass remove bodies of extern inline functions we never inlined.
      Do this later so other IPA passes see what is really going on.  */

Modified: llvm-gcc-4.2/trunk/gcc/ipa-inline.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/ipa-inline.c?rev=51257&r1=51256&r2=51257&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/ipa-inline.c (original)
+++ llvm-gcc-4.2/trunk/gcc/ipa-inline.c Mon May 19 11:42:56 2008
@@ -941,7 +941,11 @@
 	/* At the moment, no IPA passes change function bodies before inlining.
 	   Save some time by not recomputing function body sizes if early inlining
 	   already did so.  */
+        /* LLVM local begin - Don't rely on pass_early_ipa_inline being run.  */
+#ifndef ENABLE_LLVM
 	if (!flag_early_inlining)
+#endif
+        /* LLVM local end */
 	  node->local.self_insns = node->global.insns
 	     = estimate_num_insns (node->decl);
 
@@ -1028,6 +1032,8 @@
 		 overall_insns - old_insns);
     }
 
+  /* LLVM local begin */
+#ifndef ENABLE_LLVM
   if (!flag_really_no_inline)
     cgraph_decide_inlining_of_small_functions ();
 
@@ -1101,6 +1107,8 @@
 	    }
 	}
     }
+#endif
+  /* LLVM local end */
 
   if (dump_file)
     fprintf (dump_file,
@@ -1147,6 +1155,8 @@
 	inlined = true;
       }
 
+  /* LLVM local begin */
+#ifndef ENABLE_LLVM
   /* Now do the automatic inlining.  */
   if (!flag_really_no_inline)
     for (e = node->callees; e; e = e->next_callee)
@@ -1179,6 +1189,8 @@
 	  else if (!early)
 	    e->inline_failed = failed_reason;
 	}
+#endif
+  /* LLVM local end */
   if (early && inlined)
     {
       push_cfun (DECL_STRUCT_FUNCTION (node->decl));

Modified: llvm-gcc-4.2/trunk/gcc/passes.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/passes.c?rev=51257&r1=51256&r2=51257&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/passes.c (original)
+++ llvm-gcc-4.2/trunk/gcc/passes.c Mon May 19 11:42:56 2008
@@ -481,14 +481,20 @@
 #define NEXT_PASS(PASS)  (p = next_pass_1 (p, &PASS))
   /* Interprocedural optimization passes.  */
   p = &all_ipa_passes;
+  /* LLVM local begin */
+#ifndef ENABLE_LLVM
   NEXT_PASS (pass_early_ipa_inline);
   NEXT_PASS (pass_early_local_passes);
   NEXT_PASS (pass_ipa_cp);
-  NEXT_PASS (pass_ipa_inline);
+#endif
+  NEXT_PASS (pass_ipa_inline); /* LLVM: inline functions marked always_inline */
+#ifndef ENABLE_LLVM
   NEXT_PASS (pass_ipa_reference);
   NEXT_PASS (pass_ipa_pure_const); 
   NEXT_PASS (pass_ipa_type_escape);
   NEXT_PASS (pass_ipa_pta);
+#endif
+  /* LLVM local end */
   *p = NULL;
 
   /* All passes needed to lower the function into shape optimizers can





More information about the llvm-commits mailing list