[llvm-commits] [llvm] r166829 - /llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Fri Oct 26 16:05:13 PDT 2012


Author: stoklund
Date: Fri Oct 26 18:05:13 2012
New Revision: 166829

URL: http://llvm.org/viewvc/llvm-project?rev=166829&view=rev
Log:
Reduce indentation with early exit.

No functional change.

Modified:
    llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp

Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=166829&r1=166828&r2=166829&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original)
+++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Fri Oct 26 18:05:13 2012
@@ -588,35 +588,34 @@
   MachineFunction::iterator MFI = MBB;
   MachineInstr *NewMI = TII->convertToThreeAddress(MFI, mi, LV);
   assert(MBB == MFI && "convertToThreeAddress changed iterator reference");
-  if (NewMI) {
-    DEBUG(dbgs() << "2addr: CONVERTING 2-ADDR: " << *mi);
-    DEBUG(dbgs() << "2addr:         TO 3-ADDR: " << *NewMI);
-    bool Sunk = false;
-
-    if (Indexes)
-      Indexes->replaceMachineInstrInMaps(mi, NewMI);
-
-    if (NewMI->findRegisterUseOperand(RegB, false, TRI))
-      // FIXME: Temporary workaround. If the new instruction doesn't
-      // uses RegB, convertToThreeAddress must have created more
-      // then one instruction.
-      Sunk = sink3AddrInstruction(NewMI, RegB, mi);
-
-    MBB->erase(mi); // Nuke the old inst.
-
-    if (!Sunk) {
-      DistanceMap.insert(std::make_pair(NewMI, Dist));
-      mi = NewMI;
-      nmi = llvm::next(mi);
-    }
-
-    // Update source and destination register maps.
-    SrcRegMap.erase(RegA);
-    DstRegMap.erase(RegB);
-    return true;
-  }
+  if (!NewMI)
+    return false;
 
-  return false;
+  DEBUG(dbgs() << "2addr: CONVERTING 2-ADDR: " << *mi);
+  DEBUG(dbgs() << "2addr:         TO 3-ADDR: " << *NewMI);
+  bool Sunk = false;
+
+  if (Indexes)
+    Indexes->replaceMachineInstrInMaps(mi, NewMI);
+
+  if (NewMI->findRegisterUseOperand(RegB, false, TRI))
+    // FIXME: Temporary workaround. If the new instruction doesn't
+    // uses RegB, convertToThreeAddress must have created more
+    // then one instruction.
+    Sunk = sink3AddrInstruction(NewMI, RegB, mi);
+
+  MBB->erase(mi); // Nuke the old inst.
+
+  if (!Sunk) {
+    DistanceMap.insert(std::make_pair(NewMI, Dist));
+    mi = NewMI;
+    nmi = llvm::next(mi);
+  }
+
+  // Update source and destination register maps.
+  SrcRegMap.erase(RegA);
+  DstRegMap.erase(RegB);
+  return true;
 }
 
 /// scanUses - Scan forward recursively for only uses, update maps if the use





More information about the llvm-commits mailing list