Print variable's display name in dwarf DIE.
[oota-llvm.git] / lib / CodeGen / LoopAligner.cpp
index b8d00595d8a9a482f39d1f0a784524800fa0035d..b67f5c3bf9192e0a9a444a813a4331d26a316102 100644 (file)
@@ -64,8 +64,14 @@ bool LoopAligner::runOnMachineFunction(MachineFunction &MF) {
 
   for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) {
     MachineBasicBlock *MBB = I;
-    if (MLI->isLoopHeader(MBB))
+    if (MLI->isLoopHeader(MBB)) {
+      MachineBasicBlock *PredBB = prior(I);
+      if (MLI->getLoopFor(MBB) == MLI->getLoopFor(PredBB))
+        // If previously BB is in the same loop, don't align this BB. We want
+        // to prevent adding noop's inside a loop.
+        continue;
       MBB->setAlignment(Align);
+    }
   }
 
   return true;