Add some comments suggested in code review.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Fri, 6 Jul 2012 02:31:22 +0000 (02:31 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Fri, 6 Jul 2012 02:31:22 +0000 (02:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159800 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/EarlyIfConversion.cpp

index f575b249aa15f1368be0ac8956e7c846131c2af4..effddfbbad220767ef9275e4c0423f5d92fd8e54 100644 (file)
@@ -167,6 +167,9 @@ bool SSAIfConv::canSpeculateInstrs(MachineBasicBlock *MBB) {
   }
 
   unsigned InstrCount = 0;
+
+  // Check all instructions, except the terminators. It is assumed that
+  // terminators never have side effects or define any used register values.
   for (MachineBasicBlock::iterator I = MBB->begin(),
        E = MBB->getFirstTerminator(); I != E; ++I) {
     if (I->isDebugValue())
@@ -569,11 +572,15 @@ bool EarlyIfConverter::runOnMachineFunction(MachineFunction &MF) {
   bool Changed = false;
   IfConv.runOnMachineFunction(MF);
 
+  // Initially visit blocks in layout order. The tryConvertIf() function may
+  // erase blocks, but never the head block passed as MFI.
   for (MachineFunction::iterator MFI = MF.begin(), MFE = MF.end(); MFI != MFE;
        ++MFI)
     if (tryConvertIf(MFI))
       Changed = true;
 
+  // Revisit blocks identified by tryConvertIf() as candidates for nested
+  // if-conversion.
   DEBUG(dbgs() << "Revisiting " << WorkList.size() << " blocks.\n");
   while (!WorkList.empty())
     tryConvertIf(WorkList.pop_back_val());