aboutsummaryrefslogtreecommitdiffstats
path: root/tools/opt/opt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/opt/opt.cpp')
-rw-r--r--tools/opt/opt.cpp37
1 files changed, 32 insertions, 5 deletions
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index 37637ca..dba16f7 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -136,6 +136,21 @@ UnitAtATime("funit-at-a-time",
cl::init(true));
static cl::opt<bool>
+DisableLoopUnrolling("disable-loop-unrolling",
+ cl::desc("Disable loop unrolling in all relevant passes"),
+ cl::init(false));
+static cl::opt<bool>
+DisableLoopVectorization("disable-loop-vectorization",
+ cl::desc("Disable the loop vectorization pass"),
+ cl::init(false));
+
+static cl::opt<bool>
+DisableSLPVectorization("disable-slp-vectorization",
+ cl::desc("Disable the slp vectorization pass"),
+ cl::init(false));
+
+
+static cl::opt<bool>
DisableSimplifyLibCalls("disable-simplify-libcalls",
cl::desc("Disable simplify-libcalls"));
@@ -362,6 +377,7 @@ char BasicBlockPassPrinter::ID = 0;
struct BreakpointPrinter : public ModulePass {
raw_ostream &Out;
static char ID;
+ DITypeIdentifierMap TypeIdentifierMap;
BreakpointPrinter(raw_ostream &out)
: ModulePass(ID), Out(out) {
@@ -377,13 +393,18 @@ struct BreakpointPrinter : public ModulePass {
} else if (Context.isType()) {
DIType TY(Context);
if (!TY.getName().empty()) {
- getContextName(TY.getContext(), N);
+ getContextName(TY.getContext().resolve(TypeIdentifierMap), N);
N = N + TY.getName().str() + "::";
}
}
}
virtual bool runOnModule(Module &M) {
+ TypeIdentifierMap.clear();
+ NamedMDNode *CU_Nodes = M.getNamedMetadata("llvm.dbg.cu");
+ if (CU_Nodes)
+ TypeIdentifierMap = generateDITypeIdentifierMap(CU_Nodes);
+
StringSet<> Processed;
if (NamedMDNode *NMD = M.getNamedMetadata("llvm.dbg.sp"))
for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) {
@@ -393,7 +414,7 @@ struct BreakpointPrinter : public ModulePass {
"A MDNode in llvm.dbg.sp should be null or a DISubprogram.");
if (!SP)
continue;
- getContextName(SP.getContext(), Name);
+ getContextName(SP.getContext().resolve(TypeIdentifierMap), Name);
Name = Name + SP.getDisplayName().str();
if (!Name.empty() && Processed.insert(Name)) {
Out << Name << "\n";
@@ -406,7 +427,7 @@ struct BreakpointPrinter : public ModulePass {
AU.setPreservesAll();
}
};
-
+
} // anonymous namespace
char BreakpointPrinter::ID = 0;
@@ -447,8 +468,14 @@ static void AddOptimizationPasses(PassManagerBase &MPM,FunctionPassManager &FPM,
Builder.Inliner = createAlwaysInlinerPass();
}
Builder.DisableUnitAtATime = !UnitAtATime;
- Builder.DisableUnrollLoops = OptLevel == 0;
-
+ Builder.DisableUnrollLoops = (DisableLoopUnrolling.getNumOccurrences() > 0) ?
+ DisableLoopUnrolling : OptLevel == 0;
+
+ Builder.LoopVectorize =
+ DisableLoopVectorization ? false : OptLevel > 1 && SizeLevel < 2;
+ Builder.SLPVectorize =
+ DisableSLPVectorization ? false : OptLevel > 1 && SizeLevel < 2;
+
Builder.populateFunctionPassManager(FPM);
Builder.populateModulePassManager(MPM);
}