Don't read PreRegAlloc before it is initialized.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Sat, 11 Feb 2012 00:40:36 +0000 (00:40 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Sat, 11 Feb 2012 00:40:36 +0000 (00:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150286 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/MachineLICM.cpp

index f26635d5001fb07b44a4858bffaf4119cf48d5c8..fda60563ed4058c219267fa51e7f1f0d1897490c 100644 (file)
@@ -311,12 +311,6 @@ static bool LoopIsOuterMostWithPredecessor(MachineLoop *CurLoop) {
 }
 
 bool MachineLICM::runOnMachineFunction(MachineFunction &MF) {
-  if (PreRegAlloc)
-    DEBUG(dbgs() << "******** Pre-regalloc Machine LICM: ");
-  else
-    DEBUG(dbgs() << "******** Post-regalloc Machine LICM: ");
-  DEBUG(dbgs() << MF.getFunction()->getName() << " ********\n");
-
   Changed = FirstInLoop = false;
   TM = &MF.getTarget();
   TII = TM->getInstrInfo();
@@ -328,6 +322,12 @@ bool MachineLICM::runOnMachineFunction(MachineFunction &MF) {
 
   PreRegAlloc = MRI->isSSA();
 
+  if (PreRegAlloc)
+    DEBUG(dbgs() << "******** Pre-regalloc Machine LICM: ");
+  else
+    DEBUG(dbgs() << "******** Post-regalloc Machine LICM: ");
+  DEBUG(dbgs() << MF.getFunction()->getName() << " ********\n");
+
   if (PreRegAlloc) {
     // Estimate register pressure during pre-regalloc pass.
     unsigned NumRC = TRI->getNumRegClasses();