From b04148f77713c92ee57b33b7b858ad18ce8d78e3 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Tue, 4 May 2021 14:31:29 +0100 Subject: [PATCH] Local.cpp - Avoid DebugLoc copies - use const reference from getDebugLoc. NFCI. --- llvm/lib/Transforms/Utils/Local.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index ed75337..ecabe21 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -1423,7 +1423,7 @@ static bool valueCoversEntireFragment(Type *ValTy, DbgVariableIntrinsic *DII) { /// case this DebugLoc leaks into any adjacent instructions. static DebugLoc getDebugValueLoc(DbgVariableIntrinsic *DII, Instruction *Src) { // Original dbg.declare must have a location. - DebugLoc DeclareLoc = DII->getDebugLoc(); + const DebugLoc &DeclareLoc = DII->getDebugLoc(); MDNode *Scope = DeclareLoc.getScope(); DILocation *InlinedAt = DeclareLoc.getInlinedAt(); // Produce an unknown location with the correct scope / inlinedAt fields. @@ -1672,7 +1672,7 @@ bool llvm::replaceDbgDeclare(Value *Address, Value *NewAddress, int Offset) { auto DbgAddrs = FindDbgAddrUses(Address); for (DbgVariableIntrinsic *DII : DbgAddrs) { - DebugLoc Loc = DII->getDebugLoc(); + const DebugLoc &Loc = DII->getDebugLoc(); auto *DIVar = DII->getVariable(); auto *DIExpr = DII->getExpression(); assert(DIVar && "Missing variable"); @@ -1687,7 +1687,7 @@ bool llvm::replaceDbgDeclare(Value *Address, Value *NewAddress, static void replaceOneDbgValueForAlloca(DbgValueInst *DVI, Value *NewAddress, DIBuilder &Builder, int Offset) { - DebugLoc Loc = DVI->getDebugLoc(); + const DebugLoc &Loc = DVI->getDebugLoc(); auto *DIVar = DVI->getVariable(); auto *DIExpr = DVI->getExpression(); assert(DIVar && "Missing variable"); -- 2.7.4