Deleted Added
full compact
bugpoint.cpp (218885) bugpoint.cpp (223013)
1//===- bugpoint.cpp - The LLVM Bugpoint utility ---------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//

--- 8 unchanged lines hidden (view full) ---

17#include "ToolRunner.h"
18#include "llvm/LinkAllPasses.h"
19#include "llvm/LLVMContext.h"
20#include "llvm/Support/PassNameParser.h"
21#include "llvm/Support/CommandLine.h"
22#include "llvm/Support/ManagedStatic.h"
23#include "llvm/Support/PluginLoader.h"
24#include "llvm/Support/PrettyStackTrace.h"
1//===- bugpoint.cpp - The LLVM Bugpoint utility ---------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//

--- 8 unchanged lines hidden (view full) ---

17#include "ToolRunner.h"
18#include "llvm/LinkAllPasses.h"
19#include "llvm/LLVMContext.h"
20#include "llvm/Support/PassNameParser.h"
21#include "llvm/Support/CommandLine.h"
22#include "llvm/Support/ManagedStatic.h"
23#include "llvm/Support/PluginLoader.h"
24#include "llvm/Support/PrettyStackTrace.h"
25#include "llvm/Support/StandardPasses.h"
25#include "llvm/Support/PassManagerBuilder.h"
26#include "llvm/Support/Process.h"
27#include "llvm/Support/Signals.h"
28#include "llvm/Support/Valgrind.h"
29#include "llvm/LinkAllVMCore.h"
30
31//Enable this macro to debug bugpoint itself.
32//#define DEBUG_BUGPOINT 1
33

--- 30 unchanged lines hidden (view full) ---

64static cl::opt<bool>
65StandardCompileOpts("std-compile-opts",
66 cl::desc("Include the standard compile time optimizations"));
67
68static cl::opt<bool>
69StandardLinkOpts("std-link-opts",
70 cl::desc("Include the standard link time optimizations"));
71
26#include "llvm/Support/Process.h"
27#include "llvm/Support/Signals.h"
28#include "llvm/Support/Valgrind.h"
29#include "llvm/LinkAllVMCore.h"
30
31//Enable this macro to debug bugpoint itself.
32//#define DEBUG_BUGPOINT 1
33

--- 30 unchanged lines hidden (view full) ---

64static cl::opt<bool>
65StandardCompileOpts("std-compile-opts",
66 cl::desc("Include the standard compile time optimizations"));
67
68static cl::opt<bool>
69StandardLinkOpts("std-link-opts",
70 cl::desc("Include the standard link time optimizations"));
71
72static cl::opt<bool>
73OptLevelO1("O1",
74 cl::desc("Optimization level 1. Similar to llvm-gcc -O1"));
75
76static cl::opt<bool>
77OptLevelO2("O2",
78 cl::desc("Optimization level 2. Similar to llvm-gcc -O2"));
79
80static cl::opt<bool>
81OptLevelO3("O3",
82 cl::desc("Optimization level 3. Similar to llvm-gcc -O3"));
83
72static cl::opt<std::string>
73OverrideTriple("mtriple", cl::desc("Override target triple for module"));
74
75/// BugpointIsInterrupted - Set to true when the user presses ctrl-c.
76bool llvm::BugpointIsInterrupted = false;
77
78#ifndef DEBUG_BUGPOINT
79static void BugpointInterruptFunction() {
80 BugpointIsInterrupted = true;
81}
82#endif
83
84// Hack to capture a pass list.
85namespace {
84static cl::opt<std::string>
85OverrideTriple("mtriple", cl::desc("Override target triple for module"));
86
87/// BugpointIsInterrupted - Set to true when the user presses ctrl-c.
88bool llvm::BugpointIsInterrupted = false;
89
90#ifndef DEBUG_BUGPOINT
91static void BugpointInterruptFunction() {
92 BugpointIsInterrupted = true;
93}
94#endif
95
96// Hack to capture a pass list.
97namespace {
86 class AddToDriver : public PassManager {
98 class AddToDriver : public FunctionPassManager {
87 BugDriver &D;
88 public:
99 BugDriver &D;
100 public:
89 AddToDriver(BugDriver &_D) : D(_D) {}
101 AddToDriver(BugDriver &_D) : FunctionPassManager(0), D(_D) {}
90
91 virtual void add(Pass *P) {
92 const void *ID = P->getPassID();
93 const PassInfo *PI = PassRegistry::getPassRegistry()->getPassInfo(ID);
94 D.addPass(PI->getPassArgument());
95 }
96 };
97}

--- 43 unchanged lines hidden (view full) ---

141 }
142
143 BugDriver D(argv[0], FindBugs, TimeoutValue, MemoryLimit,
144 UseValgrind, Context);
145 if (D.addSources(InputFilenames)) return 1;
146
147 AddToDriver PM(D);
148 if (StandardCompileOpts) {
102
103 virtual void add(Pass *P) {
104 const void *ID = P->getPassID();
105 const PassInfo *PI = PassRegistry::getPassRegistry()->getPassInfo(ID);
106 D.addPass(PI->getPassArgument());
107 }
108 };
109}

--- 43 unchanged lines hidden (view full) ---

153 }
154
155 BugDriver D(argv[0], FindBugs, TimeoutValue, MemoryLimit,
156 UseValgrind, Context);
157 if (D.addSources(InputFilenames)) return 1;
158
159 AddToDriver PM(D);
160 if (StandardCompileOpts) {
149 createStandardModulePasses(&PM, 3,
150 /*OptimizeSize=*/ false,
151 /*UnitAtATime=*/ true,
152 /*UnrollLoops=*/ true,
153 /*SimplifyLibCalls=*/ true,
154 /*HaveExceptions=*/ true,
155 createFunctionInliningPass());
161 PassManagerBuilder Builder;
162 Builder.OptLevel = 3;
163 Builder.Inliner = createFunctionInliningPass();
164 Builder.populateModulePassManager(PM);
156 }
157
165 }
166
158 if (StandardLinkOpts)
159 createStandardLTOPasses(&PM, /*Internalize=*/true,
160 /*RunInliner=*/true,
161 /*VerifyEach=*/false);
167 if (StandardLinkOpts) {
168 PassManagerBuilder Builder;
169 Builder.populateLTOPassManager(PM, /*Internalize=*/true,
170 /*RunInliner=*/true);
171 }
162
172
173 if (OptLevelO1 || OptLevelO2 || OptLevelO3) {
174 PassManagerBuilder Builder;
175 if (OptLevelO1)
176 Builder.Inliner = createAlwaysInlinerPass();
177 else if (OptLevelO2)
178 Builder.Inliner = createFunctionInliningPass(225);
179 else
180 Builder.Inliner = createFunctionInliningPass(275);
163
181
182 // Note that although clang/llvm-gcc use two separate passmanagers
183 // here, it shouldn't normally make a difference.
184 Builder.populateFunctionPassManager(PM);
185 Builder.populateModulePassManager(PM);
186 }
187
164 for (std::vector<const PassInfo*>::iterator I = PassList.begin(),
165 E = PassList.end();
166 I != E; ++I) {
167 const PassInfo* PI = *I;
168 D.addPass(PI->getPassArgument());
169 }
170
171 // Bugpoint has the ability of generating a plethora of core files, so to

--- 13 unchanged lines hidden ---
188 for (std::vector<const PassInfo*>::iterator I = PassList.begin(),
189 E = PassList.end();
190 I != E; ++I) {
191 const PassInfo* PI = *I;
192 D.addPass(PI->getPassArgument());
193 }
194
195 // Bugpoint has the ability of generating a plethora of core files, so to

--- 13 unchanged lines hidden ---