From 68109d5dcfec8d20d5547e056753f3740a4bd0c8 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Tue, 1 Aug 2017 22:37:35 +0000 Subject: [PATCH] Use helper function instead of manually constructing DBG_VALUEs (NFC) rdar://problem/33580047 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309757 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/GlobalISel/MachineIRBuilder.cpp | 19 +++++++------------ lib/CodeGen/SelectionDAG/FastISel.cpp | 7 ++----- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp b/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp index 34a13d855cf..8ca07f36c9c 100644 --- a/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp +++ b/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp @@ -83,17 +83,15 @@ MachineInstrBuilder MachineIRBuilder::insertInstr(MachineInstrBuilder MIB) { return MIB; } -MachineInstrBuilder MachineIRBuilder::buildDirectDbgValue( - unsigned Reg, const MDNode *Variable, const MDNode *Expr) { +MachineInstrBuilder +MachineIRBuilder::buildDirectDbgValue(unsigned Reg, const MDNode *Variable, + const MDNode *Expr) { assert(isa(Variable) && "not a variable"); assert(cast(Expr)->isValid() && "not an expression"); assert(cast(Variable)->isValidLocationForIntrinsic(DL) && "Expected inlined-at fields to agree"); - return buildInstr(TargetOpcode::DBG_VALUE) - .addReg(Reg, RegState::Debug) - .addReg(0, RegState::Debug) - .addMetadata(Variable) - .addMetadata(Expr); + return insertInstr(BuildMI(getMF(), DL, getTII().get(TargetOpcode::DBG_VALUE), + /*IsIndirect*/ false, Reg, Variable, Expr)); } MachineInstrBuilder @@ -103,11 +101,8 @@ MachineIRBuilder::buildIndirectDbgValue(unsigned Reg, const MDNode *Variable, assert(cast(Expr)->isValid() && "not an expression"); assert(cast(Variable)->isValidLocationForIntrinsic(DL) && "Expected inlined-at fields to agree"); - return buildInstr(TargetOpcode::DBG_VALUE) - .addReg(Reg, RegState::Debug) - .addImm(0) - .addMetadata(Variable) - .addMetadata(Expr); + return insertInstr(BuildMI(getMF(), DL, getTII().get(TargetOpcode::DBG_VALUE), + /*IsIndirect*/ true, Reg, Variable, Expr)); } MachineInstrBuilder MachineIRBuilder::buildFIDbgValue(int FI, diff --git a/lib/CodeGen/SelectionDAG/FastISel.cpp b/lib/CodeGen/SelectionDAG/FastISel.cpp index 89b688bb03f..959735d66c4 100644 --- a/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -1212,11 +1212,8 @@ bool FastISel::selectIntrinsicCall(const IntrinsicInst *II) { if (!V) { // Currently the optimizer can produce this; insert an undef to // help debugging. Probably the optimizer should not do this. - BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, II) - .addReg(0U) - .addImm(0U) - .addMetadata(DI->getVariable()) - .addMetadata(DI->getExpression()); + BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, II, false, 0U, + DI->getVariable(), DI->getExpression()); } else if (const auto *CI = dyn_cast(V)) { if (CI->getBitWidth() > 64) BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, II) -- 2.40.0