From: Justin Bogner Date: Thu, 30 Jun 2016 18:32:12 +0000 (+0000) Subject: CodeGen: Add the other BuildMI overload for MachineInstr& X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=66b1dac2d44f63ef63a7df5ba7f02f0a76dd06db;p=llvm CodeGen: Add the other BuildMI overload for MachineInstr& The change in r274193 missed this variant. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274259 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/CodeGen/MachineInstrBuilder.h b/include/llvm/CodeGen/MachineInstrBuilder.h index da0afc32035..37b67aa0cf5 100644 --- a/include/llvm/CodeGen/MachineInstrBuilder.h +++ b/include/llvm/CodeGen/MachineInstrBuilder.h @@ -320,16 +320,20 @@ inline MachineInstrBuilder BuildMI(MachineBasicBlock &BB, 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