]> granicus.if.org Git - clang/commitdiff
[analyzer] Use analyzer config for max-inlinable-size option.
authorAnna Zaks <ganna@apple.com>
Wed, 30 Jan 2013 19:12:36 +0000 (19:12 +0000)
committerAnna Zaks <ganna@apple.com>
Wed, 30 Jan 2013 19:12:36 +0000 (19:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173957 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/CC1Options.td
include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
lib/Frontend/CompilerInvocation.cpp
lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
test/Analysis/analyzer-config.c
test/Analysis/analyzer-config.cpp

index fd83efe11b800e0c0cf2ca07906cb8e7c68883da..fa3e56fe754ec38690f2542291c07fe6afffa8ac 100644 (file)
@@ -81,11 +81,6 @@ def analyzer_inline_max_stack_depth : Separate<["-"], "analyzer-inline-max-stack
 def analyzer_inline_max_stack_depth_EQ : Joined<["-"], "analyzer-inline-max-stack-depth=">, 
   Alias<analyzer_inline_max_stack_depth>;
   
-def analyzer_inline_max_function_size : Separate<["-"], "analyzer-inline-max-function-size">,
-  HelpText<"Bound on the number of basic blocks in an inlined function (200 by default)">;
-def analyzer_inline_max_function_size_EQ : Joined<["-"], "analyzer-inline-max-function-size=">, 
-  Alias<analyzer_inline_max_function_size>;
-
 def analyzer_inlining_mode : Separate<["-"], "analyzer-inlining-mode">,
   HelpText<"Specify the function selection heuristic used during inlining">;
 def analyzer_inlining_mode_EQ : Joined<["-"], "analyzer-inlining-mode=">, Alias<analyzer_inlining_mode>;
index c84f6c3768c0530748ab86c22b9c4ead5790f37a..9b9749df98951fc75386c4a74204df6fb6cbf7c1 100644 (file)
@@ -168,9 +168,6 @@ public:
   /// \brief The inlining stack depth limit.
   unsigned InlineMaxStackDepth;
   
-  /// \brief The mode of function selection used during inlining.
-  unsigned InlineMaxFunctionSize;
-
   /// \brief The mode of function selection used during inlining.
   AnalysisInliningMode InliningMode;
 
@@ -214,6 +211,9 @@ private:
   /// \sa shouldSuppressNullReturnPaths
   llvm::Optional<bool> SuppressNullReturnPaths;
 
+  // \sa getMaxInlinableSize
+  llvm::Optional<unsigned> MaxInlinableSize;
+
   /// \sa shouldAvoidSuppressingNullArgumentPaths
   llvm::Optional<bool> AvoidSuppressingNullArgumentPaths;
 
@@ -309,7 +309,13 @@ public:
   //
   // This is controlled by "ipa-always-inline-size" analyzer-config option.
   unsigned getAlwaysInlineSize();
-  
+
+  // Returns the bound on the number of basic blocks in an inlined function
+  // (50 by default).
+  //
+  // This is controlled by "-analyzer-config max-inlinable-size" option.
+  unsigned getMaxInlinableSize();
+
   /// Returns true if the analyzer engine should synthesize fake bodies
   /// for well-known functions.
   bool shouldSynthesizeBodies();
@@ -345,7 +351,6 @@ public:
     NoRetryExhausted(0),
     // Cap the stack depth at 4 calls (5 stack frames, base + 4 calls).
     InlineMaxStackDepth(5),
-    InlineMaxFunctionSize(50),
     InliningMode(NoRedundancy),
     UserMode(UMK_NotSet),
     IPAMode(IPAK_NotSet),
index b4b0ddb1c4b26ff07e10ff4dcb1e130f59309d8f..ae240577d124b18a08a5444b8869125ff97269ca 100644 (file)
@@ -224,9 +224,6 @@ static bool ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args,
   Opts.InlineMaxStackDepth =
     Args.getLastArgIntValue(OPT_analyzer_inline_max_stack_depth,
                             Opts.InlineMaxStackDepth, Diags);
-  Opts.InlineMaxFunctionSize =
-    Args.getLastArgIntValue(OPT_analyzer_inline_max_function_size,
-                            Opts.InlineMaxFunctionSize, Diags);
 
   Opts.CheckersControlList.clear();
   for (arg_iterator it = Args.filtered_begin(OPT_analyzer_checker,
index 82d66815726c59be10eddf2869b5fd588a536b40..d90b48d998e0a6b5e9a0cfdb284de2dbf7e349ff 100644 (file)
@@ -171,6 +171,12 @@ unsigned AnalyzerOptions::getAlwaysInlineSize() {
   return AlwaysInlineSize.getValue();
 }
 
+unsigned AnalyzerOptions::getMaxInlinableSize() {
+  if (!MaxInlinableSize.hasValue())
+    MaxInlinableSize = getOptionAsInteger("max-inlinable-size", 50);
+  return MaxInlinableSize.getValue();
+}
+
 unsigned AnalyzerOptions::getGraphTrimInterval() {
   if (!GraphTrimInterval.hasValue())
     GraphTrimInterval = getOptionAsInteger("graph-trim-interval", 1000);
index e18d69316191375705b543f5287d10bb6096e3d7..2c1f6c1d8f9faf5da0294d4ed34a7e105ba75cdd 100644 (file)
@@ -415,7 +415,7 @@ bool ExprEngine::shouldInlineDecl(const Decl *D, ExplodedNode *Pred) {
   if (Engine.FunctionSummaries->hasReachedMaxBlockCount(D))
     return false;
 
-  if (CalleeCFG->getNumBlockIDs() > AMgr.options.InlineMaxFunctionSize)
+  if (CalleeCFG->getNumBlockIDs() > AMgr.options.getMaxInlinableSize())
     return false;
 
   // Do not inline variadic calls (for now).
index a314f9cd944e1ec957289857a5144f97a71e9741..9d99b0a425dd572db90860a908a2f0e1689def41 100644 (file)
@@ -10,7 +10,8 @@ void foo() { bar(); }
 // CHECK-NEXT: graph-trim-interval = 1000
 // CHECK-NEXT: ipa = dynamic-bifurcate
 // CHECK-NEXT: ipa-always-inline-size = 3
+// CHECK-NEXT: max-inlinable-size = 50
 // CHECK-NEXT: max-times-inline-large = 32
 // CHECK-NEXT: mode = deep
 // CHECK-NEXT: [stats]
-// CHECK-NEXT: num-entries = 7
+// CHECK-NEXT: num-entries = 8
index 10a9ff17305dfcba29d2efaf5ffe4cabbfba90d7..dafc86fe862a10904e59b3345b1fa048940eaa80 100644 (file)
@@ -19,7 +19,8 @@ public:
 // CHECK-NEXT: graph-trim-interval = 1000
 // CHECK-NEXT: ipa = dynamic-bifurcate
 // CHECK-NEXT: ipa-always-inline-size = 3
+// CHECK-NEXT: max-inlinable-size = 50
 // CHECK-NEXT: max-times-inline-large = 32
 // CHECK-NEXT: mode = deep
 // CHECK-NEXT: [stats]
-// CHECK-NEXT: num-entries = 10
+// CHECK-NEXT: num-entries = 11