[llvm] r274259 - CodeGen: Add the other BuildMI overload for MachineInstr&

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 30 11:32:12 PDT 2016


Author: bogner
Date: Thu Jun 30 13:32:12 2016
New Revision: 274259

URL: http://llvm.org/viewvc/llvm-project?rev=274259&view=rev
Log:
CodeGen: Add the other BuildMI overload for MachineInstr&

The change in r274193 missed this variant.

Modified:
    llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h

Modified: llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h?rev=274259&r1=274258&r2=274259&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h Thu Jun 30 13:32:12 2016
@@ -320,16 +320,20 @@ inline MachineInstrBuilder BuildMI(Machi
   return MachineInstrBuilder(MF, MI);
 }
 
-inline MachineInstrBuilder BuildMI(MachineBasicBlock &BB, MachineInstr *I,
+inline MachineInstrBuilder BuildMI(MachineBasicBlock &BB, MachineInstr &I,
                                    const DebugLoc &DL,
                                    const MCInstrDesc &MCID) {
-  if (I->isInsideBundle()) {
-    MachineBasicBlock::instr_iterator MII(I);
-    return BuildMI(BB, MII, DL, MCID);
-  }
+  // Calling the overload for instr_iterator is always correct.  However, the
+  // definition is not available in headers, so inline the check.
+  if (I.isInsideBundle())
+    return BuildMI(BB, MachineBasicBlock::instr_iterator(I), DL, MCID);
+  return BuildMI(BB, MachineBasicBlock::iterator(I), DL, MCID);
+}
 
-  MachineBasicBlock::iterator MII = I;
-  return BuildMI(BB, MII, DL, MCID);
+inline MachineInstrBuilder BuildMI(MachineBasicBlock &BB, MachineInstr *I,
+                                   const DebugLoc &DL,
+                                   const MCInstrDesc &MCID) {
+  return BuildMI(BB, *I, DL, MCID);
 }
 
 /// This version of the builder inserts the newly-built instruction at the end




More information about the llvm-commits mailing list