llvm.org GIT mirror llvm / d720670
The BlockExtractorPass() constructor was not reading the BlockFile and that was exactly what bugpoint expected it to do. There was also only one user of BlockExtractorPass(const std::vector<BasicBlock*> &B), so just remove it and make BlockExtractorPass read BlockFile. This fixes bugpoint's block extraction. Nick, please review. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109936 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 10 years ago
3 changed file(s) with 5 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
180180 /// createBlockExtractorPass - This pass extracts all blocks (except those
181181 /// specified in the argument list) from the functions in the module.
182182 ///
183 ModulePass *createBlockExtractorPass(const std::vector &BTNE);
183 ModulePass *createBlockExtractorPass();
184184
185185 /// createStripDeadPrototypesPass - This pass removes any function declarations
186186 /// (prototypes) that are not used.
146146 std::vector > BlocksToNotExtractByName;
147147 public:
148148 static char ID; // Pass identification, replacement for typeid
149 explicit BlockExtractorPass(const std::vector &B)
150 : ModulePass(&ID), BlocksToNotExtract(B) {
149 BlockExtractorPass() : ModulePass(&ID) {
151150 if (!BlockFile.empty())
152151 LoadFile(BlockFile.c_str());
153152 }
154 BlockExtractorPass() : ModulePass(&ID) {}
155153
156154 bool runOnModule(Module &M);
157155 };
165163 // createBlockExtractorPass - This pass extracts all blocks (except those
166164 // specified in the argument list) from the functions in the module.
167165 //
168 ModulePass *llvm::createBlockExtractorPass(const std::vector &BTNE)
166 ModulePass *llvm::createBlockExtractorPass()
169167 {
170 return new BlockExtractorPass(BTNE);
168 return new BlockExtractorPass();
171169 }
172170
173171 void BlockExtractorPass::LoadFile(const char *Filename) {
353353 const char *ExtraArg = uniqueFN.c_str();
354354
355355 std::vector PI;
356 std::vector EmptyBBs; // This parameter is ignored.
357 PI.push_back(getPI(createBlockExtractorPass(EmptyBBs)));
356 PI.push_back(getPI(createBlockExtractorPass()));
358357 Module *Ret = runPassesOn(M, PI, false, 1, &ExtraArg);
359358
360359 uniqueFilename.eraseFromDisk(); // Free disk space