[llvm-commits] [llvm] r55271 - /llvm/trunk/lib/Transforms/Scalar/SCCP.cpp

Chris Lattner sabre at nondot.org
Sat Aug 23 16:39:31 PDT 2008


Author: lattner
Date: Sat Aug 23 18:39:31 2008
New Revision: 55271

URL: http://llvm.org/viewvc/llvm-project?rev=55271&view=rev
Log:
improve encapsulation of the BBExecutable set.

Modified:
    llvm/trunk/lib/Transforms/Scalar/SCCP.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=55271&r1=55270&r2=55271&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Sat Aug 23 18:39:31 2008
@@ -224,10 +224,8 @@
   /// 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 @@
   // 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 @@
   // 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 @@
       }
 
     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;
 





More information about the llvm-commits mailing list