minor cleanups
authorChris Lattner <sabre@nondot.org>
Sun, 4 Mar 2007 04:50:21 +0000 (04:50 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 4 Mar 2007 04:50:21 +0000 (04:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34904 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/SCCP.cpp

index 72093980efb1fb511a00fca400a79ed881b0c774..cdcdcc664e838f3f309863c7934ffb5f0ff16de3 100644 (file)
@@ -239,6 +239,9 @@ public:
     return TrackedGlobals;
   }
 
+  inline void markOverdefined(Value *V) {
+    markOverdefined(ValueState[V], V);
+  }
 
 private:
   // markConstant - Make a value be marked as "constant".  If the value
@@ -277,9 +280,6 @@ private:
       OverdefinedInstWorkList.push_back(V);
     }
   }
-  inline void markOverdefined(Value *V) {
-    markOverdefined(ValueState[V], V);
-  }
 
   inline void mergeInValue(LatticeVal &IV, Value *V, LatticeVal &MergeWithV) {
     if (IV.isOverdefined() || MergeWithV.isUndefined())
@@ -1365,9 +1365,8 @@ bool SCCP::runOnFunction(Function &F) {
   Solver.MarkBlockExecutable(F.begin());
 
   // Mark all arguments to the function as being overdefined.
-  std::map<Value*, LatticeVal> &Values = Solver.getValueMapping();
   for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); AI != E; ++AI)
-    Values[AI].markOverdefined();
+    Solver.markOverdefined(AI);
 
   // Solve for constants.
   bool ResolvedUndefs = true;
@@ -1385,6 +1384,8 @@ bool SCCP::runOnFunction(Function &F) {
   //
   SmallSet<BasicBlock*, 16> &ExecutableBBs = Solver.getExecutableBlocks();
   SmallVector<Instruction*, 32> Insts;
+  std::map<Value*, LatticeVal> &Values = Solver.getValueMapping();
+
   for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
     if (!ExecutableBBs.count(BB)) {
       DOUT << "  BasicBlock Dead:" << *BB;
@@ -1486,14 +1487,13 @@ bool IPSCCP::runOnModule(Module &M) {
   // Loop over all functions, marking arguments to those with their addresses
   // taken or that are external as overdefined.
   //
-  std::map<Value*, LatticeVal> &Values = Solver.getValueMapping();
   for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F)
     if (!F->hasInternalLinkage() || AddressIsTaken(F)) {
       if (!F->isDeclaration())
         Solver.MarkBlockExecutable(F->begin());
       for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end();
            AI != E; ++AI)
-        Values[AI].markOverdefined();
+        Solver.markOverdefined(AI);
     } else {
       Solver.AddTrackedFunction(F);
     }
@@ -1525,6 +1525,7 @@ bool IPSCCP::runOnModule(Module &M) {
   SmallSet<BasicBlock*, 16> &ExecutableBBs = Solver.getExecutableBlocks();
   SmallVector<Instruction*, 32> Insts;
   SmallVector<BasicBlock*, 32> BlocksToErase;
+  std::map<Value*, LatticeVal> &Values = Solver.getValueMapping();
 
   for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) {
     for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end();