]> granicus.if.org Git - clang/commitdiff
Increase inlining threshold at -O3, to match llvm-gcc.
authorDaniel Dunbar <daniel@zuster.org>
Tue, 8 Dec 2009 23:15:55 +0000 (23:15 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Tue, 8 Dec 2009 23:15:55 +0000 (23:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90897 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/Backend.cpp

index 5930b33028dbd0f70bdef1857450d22eafc29e8b..03b60e01d0a40d0d7154876e5384bbbaf97be83d 100644 (file)
@@ -331,8 +331,14 @@ void BackendConsumer::CreatePasses() {
   switch (Inlining) {
   case CodeGenOptions::NoInlining: break;
   case CodeGenOptions::NormalInlining: {
-    // Inline small functions
-    unsigned Threshold = (CodeGenOpts.OptimizeSize || OptLevel < 3) ? 50 : 200;
+    // Set the inline threshold following llvm-gcc.
+    //
+    // FIXME: Derive these constants in a principled fashion.
+    unsigned Threshold = 200;
+    if (CodeGenOpts.OptimizeSize)
+      Threshold = 50;
+    else if (OptLevel > 2)
+      Threshold = 250;
     InliningPass = createFunctionInliningPass(Threshold);
     break;
   }