diff options
author | Chris Lattner <sabre@nondot.org> | 2008-08-23 23:39:31 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-08-23 23:39:31 +0000 |
commit | 7eb01bfc1645abbed0ee898a5df7ff9e4f407c38 (patch) | |
tree | 559eea5f6ad5665c53fb1533df35d3ca990e8cec /lib/Transforms/Scalar/SCCP.cpp | |
parent | cf712dee9398ea24720da9dc14462df5d9471762 (diff) | |
download | external_llvm-7eb01bfc1645abbed0ee898a5df7ff9e4f407c38.zip external_llvm-7eb01bfc1645abbed0ee898a5df7ff9e4f407c38.tar.gz external_llvm-7eb01bfc1645abbed0ee898a5df7ff9e4f407c38.tar.bz2 |
improve encapsulation of the BBExecutable set.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55271 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/SCCP.cpp')
-rw-r--r-- | lib/Transforms/Scalar/SCCP.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index e299950..ed0f727 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -224,10 +224,8 @@ public: /// should be rerun. bool ResolvedUndefsIn(Function &F); - /// getExecutableBlocks - Once we have solved for constants, return the set of - /// blocks that is known to be executable. - DenseSet<BasicBlock*> &getExecutableBlocks() { - return BBExecutable; + bool isBlockExecutable(BasicBlock *BB) const { + return BBExecutable.count(BB); } /// getValueMapping - Once we have solved for constants, return the mapping of @@ -1550,12 +1548,11 @@ bool SCCP::runOnFunction(Function &F) { // delete their contents now. Note that we cannot actually delete the blocks, // as we cannot modify the CFG of the function. // - DenseSet<BasicBlock*> &ExecutableBBs = Solver.getExecutableBlocks(); SmallVector<Instruction*, 512> Insts; std::map<Value*, LatticeVal> &Values = Solver.getValueMapping(); for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) - if (!ExecutableBBs.count(BB)) { + if (!Solver.isBlockExecutable(BB)) { DOUT << " BasicBlock Dead:" << *BB; ++NumDeadBlocks; @@ -1695,7 +1692,6 @@ bool IPSCCP::runOnModule(Module &M) { // Iterate over all of the instructions in the module, replacing them with // constants if we have found them to be of constant values. // - DenseSet<BasicBlock*> &ExecutableBBs = Solver.getExecutableBlocks(); SmallVector<Instruction*, 512> Insts; SmallVector<BasicBlock*, 512> BlocksToErase; std::map<Value*, LatticeVal> &Values = Solver.getValueMapping(); @@ -1718,7 +1714,7 @@ bool IPSCCP::runOnModule(Module &M) { } for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) - if (!ExecutableBBs.count(BB)) { + if (!Solver.isBlockExecutable(BB)) { DOUT << " BasicBlock Dead:" << *BB; ++IPNumDeadBlocks; |