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
This commit is contained in:
Rafael Espindola 2010-07-31 00:32:17 +00:00
parent 7f9cb744f2
commit d720670393
3 changed files with 5 additions and 8 deletions

View File

@ -181,7 +181,7 @@ Pass *createSingleLoopExtractorPass();
/// createBlockExtractorPass - This pass extracts all blocks (except those /// createBlockExtractorPass - This pass extracts all blocks (except those
/// specified in the argument list) from the functions in the module. /// specified in the argument list) from the functions in the module.
/// ///
ModulePass *createBlockExtractorPass(const std::vector<BasicBlock*> &BTNE); ModulePass *createBlockExtractorPass();
/// createStripDeadPrototypesPass - This pass removes any function declarations /// createStripDeadPrototypesPass - This pass removes any function declarations
/// (prototypes) that are not used. /// (prototypes) that are not used.

View File

@ -147,12 +147,10 @@ namespace {
std::vector<std::pair<std::string, std::string> > BlocksToNotExtractByName; std::vector<std::pair<std::string, std::string> > BlocksToNotExtractByName;
public: public:
static char ID; // Pass identification, replacement for typeid static char ID; // Pass identification, replacement for typeid
explicit BlockExtractorPass(const std::vector<BasicBlock*> &B) BlockExtractorPass() : ModulePass(&ID) {
: ModulePass(&ID), BlocksToNotExtract(B) {
if (!BlockFile.empty()) if (!BlockFile.empty())
LoadFile(BlockFile.c_str()); LoadFile(BlockFile.c_str());
} }
BlockExtractorPass() : ModulePass(&ID) {}
bool runOnModule(Module &M); bool runOnModule(Module &M);
}; };
@ -166,9 +164,9 @@ INITIALIZE_PASS(BlockExtractorPass, "extract-blocks",
// createBlockExtractorPass - This pass extracts all blocks (except those // createBlockExtractorPass - This pass extracts all blocks (except those
// specified in the argument list) from the functions in the module. // specified in the argument list) from the functions in the module.
// //
ModulePass *llvm::createBlockExtractorPass(const std::vector<BasicBlock*> &BTNE) ModulePass *llvm::createBlockExtractorPass()
{ {
return new BlockExtractorPass(BTNE); return new BlockExtractorPass();
} }
void BlockExtractorPass::LoadFile(const char *Filename) { void BlockExtractorPass::LoadFile(const char *Filename) {

View File

@ -354,8 +354,7 @@ Module *BugDriver::ExtractMappedBlocksFromModule(const
const char *ExtraArg = uniqueFN.c_str(); const char *ExtraArg = uniqueFN.c_str();
std::vector<const PassInfo*> PI; std::vector<const PassInfo*> PI;
std::vector<BasicBlock *> EmptyBBs; // This parameter is ignored. PI.push_back(getPI(createBlockExtractorPass()));
PI.push_back(getPI(createBlockExtractorPass(EmptyBBs)));
Module *Ret = runPassesOn(M, PI, false, 1, &ExtraArg); Module *Ret = runPassesOn(M, PI, false, 1, &ExtraArg);
uniqueFilename.eraseFromDisk(); // Free disk space uniqueFilename.eraseFromDisk(); // Free disk space