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.cpp24
1 files changed, 6 insertions, 18 deletions
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index d952525..c1e120a 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -185,10 +185,8 @@ static inline void addPass(legacy::PassManagerBase &PM, Pass *P) {
PM.add(P);
// If we are verifying all of the intermediate steps, add the verifier...
- if (VerifyEach) {
+ if (VerifyEach)
PM.add(createVerifierPass());
- PM.add(createDebugInfoVerifierPass());
- }
}
/// This routine adds optimization passes based on selected optimization level,
@@ -198,8 +196,7 @@ static inline void addPass(legacy::PassManagerBase &PM, Pass *P) {
static void AddOptimizationPasses(legacy::PassManagerBase &MPM,
legacy::FunctionPassManager &FPM,
unsigned OptLevel, unsigned SizeLevel) {
- FPM.add(createVerifierPass()); // Verify that input is correct
- MPM.add(createDebugInfoVerifierPass()); // Verify that debug info is correct
+ FPM.add(createVerifierPass()); // Verify that input is correct
PassManagerBuilder Builder;
Builder.OptLevel = OptLevel;
@@ -234,7 +231,6 @@ static void AddOptimizationPasses(legacy::PassManagerBase &MPM,
static void AddStandardLinkPasses(legacy::PassManagerBase &PM) {
PassManagerBuilder Builder;
Builder.VerifyInput = true;
- Builder.StripDebug = StripDebug;
if (DisableOptimizations)
Builder.OptLevel = 0;
@@ -247,7 +243,7 @@ static void AddStandardLinkPasses(legacy::PassManagerBase &PM) {
// CodeGen-related helper functions.
//
-CodeGenOpt::Level GetCodeGenOptLevel() {
+static CodeGenOpt::Level GetCodeGenOptLevel() {
if (OptLevelO1)
return CodeGenOpt::Less;
if (OptLevelO2)
@@ -419,15 +415,11 @@ int main(int argc, char **argv) {
Passes.add(new TargetLibraryInfoWrapperPass(TLII));
// Add an appropriate DataLayout instance for this module.
- const DataLayout *DL = M->getDataLayout();
- if (!DL && !DefaultDataLayout.empty()) {
+ const DataLayout &DL = M->getDataLayout();
+ if (DL.isDefault() && !DefaultDataLayout.empty()) {
M->setDataLayout(DefaultDataLayout);
- DL = M->getDataLayout();
}
- if (DL)
- Passes.add(new DataLayoutPass());
-
// Add internal analysis passes from the target machine.
Passes.add(createTargetTransformInfoWrapperPass(TM ? TM->getTargetIRAnalysis()
: TargetIRAnalysis()));
@@ -435,8 +427,6 @@ int main(int argc, char **argv) {
std::unique_ptr<legacy::FunctionPassManager> FPasses;
if (OptLevelO1 || OptLevelO2 || OptLevelOs || OptLevelOz || OptLevelO3) {
FPasses.reset(new legacy::FunctionPassManager(M.get()));
- if (DL)
- FPasses->add(new DataLayoutPass());
FPasses->add(createTargetTransformInfoWrapperPass(
TM ? TM->getTargetIRAnalysis() : TargetIRAnalysis()));
}
@@ -565,10 +555,8 @@ int main(int argc, char **argv) {
}
// Check that the module is well formed on completion of optimization
- if (!NoVerify && !VerifyEach) {
+ if (!NoVerify && !VerifyEach)
Passes.add(createVerifierPass());
- Passes.add(createDebugInfoVerifierPass());
- }
// Write bitcode or assembly to the output as the last step...
if (!NoOutput && !AnalyzeOnly) {