[llvm-branch-commits] [llvm-branch] r99292 - in /llvm/branches/release_27: ./ include/llvm/CodeGen/MachineJumpTableInfo.h lib/CodeGen/BranchFolding.cpp lib/CodeGen/MachineFunction.cpp

Tanya Lattner tonic at nondot.org
Tue Mar 23 10:15:19 PDT 2010


Author: tbrethou
Date: Tue Mar 23 12:15:19 2010
New Revision: 99292

URL: http://llvm.org/viewvc/llvm-project?rev=99292&view=rev
Log:
 Merge 98977 from mainline.

Modified:
    llvm/branches/release_27/   (props changed)
    llvm/branches/release_27/include/llvm/CodeGen/MachineJumpTableInfo.h
    llvm/branches/release_27/lib/CodeGen/BranchFolding.cpp
    llvm/branches/release_27/lib/CodeGen/MachineFunction.cpp

Propchange: llvm/branches/release_27/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar 23 12:15:19 2010
@@ -1 +1 @@
-/llvm/trunk:97965,97974,97980,98171,98193,98203,98205,98212,98416,98561,98845
+/llvm/trunk:97965,97974,97980,98171,98193,98203,98205,98212,98416,98561,98845,98977

Modified: llvm/branches/release_27/include/llvm/CodeGen/MachineJumpTableInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_27/include/llvm/CodeGen/MachineJumpTableInfo.h?rev=99292&r1=99291&r2=99292&view=diff
==============================================================================
--- llvm/branches/release_27/include/llvm/CodeGen/MachineJumpTableInfo.h (original)
+++ llvm/branches/release_27/include/llvm/CodeGen/MachineJumpTableInfo.h Tue Mar 23 12:15:19 2010
@@ -83,10 +83,6 @@
   ///
   unsigned createJumpTableIndex(const std::vector<MachineBasicBlock*> &DestBBs);
   
-  /// getJumpTableIndex - Return the index for an existing jump table.
-  ///
-  unsigned getJumpTableIndex(const std::vector<MachineBasicBlock*> &DestBBs);
-  
   /// isEmpty - Return true if there are no jump tables.
   ///
   bool isEmpty() const { return JumpTables.empty(); }

Modified: llvm/branches/release_27/lib/CodeGen/BranchFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_27/lib/CodeGen/BranchFolding.cpp?rev=99292&r1=99291&r2=99292&view=diff
==============================================================================
--- llvm/branches/release_27/lib/CodeGen/BranchFolding.cpp (original)
+++ llvm/branches/release_27/lib/CodeGen/BranchFolding.cpp Tue Mar 23 12:15:19 2010
@@ -203,7 +203,7 @@
     MadeChange |= MadeChangeThisIteration;
   }
 
-  // See if any jump tables have become mergable or dead as the code generator
+  // See if any jump tables have become dead as the code generator
   // did its thing.
   MachineJumpTableInfo *JTI = MF.getJumpTableInfo();
   if (JTI == 0) {
@@ -211,27 +211,8 @@
     return MadeChange;
   }
   
-  const std::vector<MachineJumpTableEntry> &JTs = JTI->getJumpTables();
-  // Figure out how these jump tables should be merged.
-  std::vector<unsigned> JTMapping;
-  JTMapping.reserve(JTs.size());
-
-  // We always keep the 0th jump table.
-  JTMapping.push_back(0);
-
-  // Scan the jump tables, seeing if there are any duplicates.  Note that this
-  // is N^2, which should be fixed someday.
-  for (unsigned i = 1, e = JTs.size(); i != e; ++i) {
-    if (JTs[i].MBBs.empty())
-      JTMapping.push_back(i);
-    else
-      JTMapping.push_back(JTI->getJumpTableIndex(JTs[i].MBBs));
-  }
-
-  // If a jump table was merge with another one, walk the function rewriting
-  // references to jump tables to reference the new JT ID's.  Keep track of
-  // whether we see a jump table idx, if not, we can delete the JT.
-  BitVector JTIsLive(JTs.size());
+  // Walk the function to find jump tables that are live.
+  BitVector JTIsLive(JTI->getJumpTables().size());
   for (MachineFunction::iterator BB = MF.begin(), E = MF.end();
        BB != E; ++BB) {
     for (MachineBasicBlock::iterator I = BB->begin(), E = BB->end();
@@ -239,17 +220,14 @@
       for (unsigned op = 0, e = I->getNumOperands(); op != e; ++op) {
         MachineOperand &Op = I->getOperand(op);
         if (!Op.isJTI()) continue;
-        unsigned NewIdx = JTMapping[Op.getIndex()];
-        Op.setIndex(NewIdx);
 
         // Remember that this JT is live.
-        JTIsLive.set(NewIdx);
+        JTIsLive.set(Op.getIndex());
       }
   }
 
-  // Finally, remove dead jump tables.  This happens either because the
-  // indirect jump was unreachable (and thus deleted) or because the jump
-  // table was merged with some other one.
+  // Finally, remove dead jump tables.  This happens when the
+  // indirect jump was unreachable (and thus deleted).
   for (unsigned i = 0, e = JTIsLive.size(); i != e; ++i)
     if (!JTIsLive.test(i)) {
       JTI->RemoveJumpTable(i);

Modified: llvm/branches/release_27/lib/CodeGen/MachineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_27/lib/CodeGen/MachineFunction.cpp?rev=99292&r1=99291&r2=99292&view=diff
==============================================================================
--- llvm/branches/release_27/lib/CodeGen/MachineFunction.cpp (original)
+++ llvm/branches/release_27/lib/CodeGen/MachineFunction.cpp Tue Mar 23 12:15:19 2010
@@ -603,17 +603,6 @@
   return JumpTables.size()-1;
 }
 
-/// getJumpTableIndex - Return the index for an existing jump table entry in
-/// the jump table info.
-unsigned MachineJumpTableInfo::getJumpTableIndex(
-                               const std::vector<MachineBasicBlock*> &DestBBs) {
-  for (unsigned i = 0, e = JumpTables.size(); i != e; ++i)
-    if (JumpTables[i].MBBs == DestBBs)
-      return i;
-  assert(false && "getJumpTableIndex failed to find matching table");
-  return ~0;
-}
-
 /// ReplaceMBBInJumpTables - If Old is the target of any jump tables, update
 /// the jump tables to branch to New instead.
 bool MachineJumpTableInfo::ReplaceMBBInJumpTables(MachineBasicBlock *Old,





More information about the llvm-branch-commits mailing list