[llvm-branch-commits] [llvm-branch] r105067 - /llvm/branches/Apple/Morbo/lib/CodeGen/MachineLICM.cpp

Evan Cheng evan.cheng at apple.com
Fri May 28 17:19:38 PDT 2010


Author: evancheng
Date: Fri May 28 19:19:38 2010
New Revision: 105067

URL: http://llvm.org/viewvc/llvm-project?rev=105067&view=rev
Log:
Merge 105065.

Modified:
    llvm/branches/Apple/Morbo/lib/CodeGen/MachineLICM.cpp

Modified: llvm/branches/Apple/Morbo/lib/CodeGen/MachineLICM.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/lib/CodeGen/MachineLICM.cpp?rev=105067&r1=105066&r2=105067&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/lib/CodeGen/MachineLICM.cpp (original)
+++ llvm/branches/Apple/Morbo/lib/CodeGen/MachineLICM.cpp Fri May 28 19:19:38 2010
@@ -62,6 +62,7 @@
 
     // State that is updated as we process loops
     bool         Changed;          // True if a loop is changed.
+    bool         FirstInLoop;      // True if it's the first LICM in the loop.
     MachineLoop *CurLoop;          // The current loop we are working on.
     MachineBasicBlock *CurPreheader; // The preheader for CurLoop.
 
@@ -211,7 +212,7 @@
   else
     DEBUG(dbgs() << "******** Post-regalloc Machine LICM ********\n");
 
-  Changed = false;
+  Changed = FirstInLoop = false;
   TM = &MF.getTarget();
   TII = TM->getInstrInfo();
   TRI = TM->getRegisterInfo();
@@ -248,6 +249,7 @@
       // CSEMap is initialized for loop header when the first instruction is
       // being hoisted.
       MachineDomTreeNode *N = DT->getNode(CurLoop->getHeader());
+      FirstInLoop = true;
       HoistRegion(N);
       CSEMap.clear();
     }
@@ -778,7 +780,10 @@
 
   // If this is the first instruction being hoisted to the preheader,
   // initialize the CSE map with potential common expressions.
-  InitCSEMap(CurPreheader);
+  if (FirstInLoop) {
+    InitCSEMap(CurPreheader);
+    FirstInLoop = false;
+  }
 
   // Look for opportunity to CSE the hoisted instruction.
   unsigned Opcode = MI->getOpcode();





More information about the llvm-branch-commits mailing list