summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2013-01-30 19:12:39 +0000
committerAnna Zaks <ganna@apple.com>2013-01-30 19:12:39 +0000
commitc84d151892303a86478ec8ed7b12d0e03d6747c9 (patch)
tree6fe277d5bf7fbc7948c38f3bb9ebf00ad5db8540 /clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
parent66b9f1660eac648d55a147e658c2e256ca2320fb (diff)
downloadbcm5719-llvm-c84d151892303a86478ec8ed7b12d0e03d6747c9.tar.gz
bcm5719-llvm-c84d151892303a86478ec8ed7b12d0e03d6747c9.zip
[analyzer] Make shallow mode more shallow.
Redefine the shallow mode to inline all functions for which we have a definite definition (ipa=inlining). However, only inline functions that are up to 4 basic blocks large and cut the max exploded nodes generated per top level function in half. This makes shallow faster and allows us to keep inlining small functions. For example, we would keep inlining wrapper functions and constructors/destructors. With the new shallow, it takes 104s to analyze sqlite3, whereas the deep mode is 658s and previous shallow is 209s. llvm-svn: 173958
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp41
1 files changed, 38 insertions, 3 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp b/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
index d90b48d998e..cb02e94d603 100644
--- a/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
+++ b/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
@@ -15,6 +15,7 @@
#include "clang/StaticAnalyzer/Core/AnalyzerOptions.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringSwitch.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
using namespace clang;
@@ -41,7 +42,7 @@ IPAKind AnalyzerOptions::getIPAMode() {
const char *DefaultIPA = 0;
UserModeKind HighLevelMode = getUserMode();
if (HighLevelMode == UMK_Shallow)
- DefaultIPA = "basic-inlining";
+ DefaultIPA = "inlining";
else if (HighLevelMode == UMK_Deep)
DefaultIPA = "dynamic-bifurcate";
assert(DefaultIPA);
@@ -172,8 +173,23 @@ unsigned AnalyzerOptions::getAlwaysInlineSize() {
}
unsigned AnalyzerOptions::getMaxInlinableSize() {
- if (!MaxInlinableSize.hasValue())
- MaxInlinableSize = getOptionAsInteger("max-inlinable-size", 50);
+ if (!MaxInlinableSize.hasValue()) {
+
+ int DefaultValue = 0;
+ UserModeKind HighLevelMode = getUserMode();
+ switch (HighLevelMode) {
+ default:
+ llvm_unreachable("Invalid mode.");
+ case UMK_Shallow:
+ DefaultValue = 4;
+ break;
+ case UMK_Deep:
+ DefaultValue = 50;
+ break;
+ }
+
+ MaxInlinableSize = getOptionAsInteger("max-inlinable-size", DefaultValue);
+ }
return MaxInlinableSize.getValue();
}
@@ -189,6 +205,25 @@ unsigned AnalyzerOptions::getMaxTimesInlineLarge() {
return MaxTimesInlineLarge.getValue();
}
+unsigned AnalyzerOptions::getMaxNodesPerTopLevelFunction() {
+ if (!MaxNodesPerTopLevelFunction.hasValue()) {
+ int DefaultValue = 0;
+ UserModeKind HighLevelMode = getUserMode();
+ switch (HighLevelMode) {
+ default:
+ llvm_unreachable("Invalid mode.");
+ case UMK_Shallow:
+ DefaultValue = 75000;
+ break;
+ case UMK_Deep:
+ DefaultValue = 150000;
+ break;
+ }
+ MaxNodesPerTopLevelFunction = getOptionAsInteger("max-nodes", DefaultValue);
+ }
+ return MaxNodesPerTopLevelFunction.getValue();
+}
+
bool AnalyzerOptions::shouldSynthesizeBodies() {
return getBooleanOption("faux-bodies", true);
}
OpenPOWER on IntegriCloud