[llvm] r301665 - Cleanup: Use DIExpression::prepend in buildDbgValueForSpill(). (NFC)
Adrian Prantl via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 28 11:30:37 PDT 2017
Author: adrian
Date: Fri Apr 28 13:30:36 2017
New Revision: 301665
URL: http://llvm.org/viewvc/llvm-project?rev=301665&view=rev
Log:
Cleanup: Use DIExpression::prepend in buildDbgValueForSpill(). (NFC)
Modified:
llvm/trunk/include/llvm/IR/DebugInfoMetadata.h
llvm/trunk/lib/CodeGen/MachineInstr.cpp
llvm/trunk/lib/IR/DebugInfoMetadata.cpp
Modified: llvm/trunk/include/llvm/IR/DebugInfoMetadata.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfoMetadata.h?rev=301665&r1=301664&r2=301665&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DebugInfoMetadata.h (original)
+++ llvm/trunk/include/llvm/IR/DebugInfoMetadata.h Fri Apr 28 13:30:36 2017
@@ -2286,7 +2286,7 @@ public:
/// Prepend \p DIExpr with a deref and offset operation and optionally turn it
/// into a stack value.
- static DIExpression *prepend(DIExpression *DIExpr, bool Deref,
+ static DIExpression *prepend(const DIExpression *DIExpr, bool Deref,
int64_t Offset = 0, bool StackValue = false);
};
Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=301665&r1=301664&r2=301665&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Fri Apr 28 13:30:36 2017
@@ -2350,7 +2350,7 @@ MachineInstr *llvm::buildDbgValueForSpil
const MachineInstr &Orig,
int FrameIndex) {
const MDNode *Var = Orig.getDebugVariable();
- auto *Expr = cast_or_null<DIExpression>(Orig.getDebugExpression());
+ const auto *Expr = cast_or_null<DIExpression>(Orig.getDebugExpression());
bool IsIndirect = Orig.isIndirectDebugValue();
uint64_t Offset = IsIndirect ? Orig.getOperand(1).getImm() : 0;
DebugLoc DL = Orig.getDebugLoc();
@@ -2359,13 +2359,8 @@ MachineInstr *llvm::buildDbgValueForSpil
// If the DBG_VALUE already was a memory location, add an extra
// DW_OP_deref. Otherwise just turning this from a register into a
// memory/indirect location is sufficient.
- if (IsIndirect) {
- SmallVector<uint64_t, 8> Ops;
- Ops.push_back(dwarf::DW_OP_deref);
- if (Expr)
- Ops.append(Expr->elements_begin(), Expr->elements_end());
- Expr = DIExpression::get(Expr->getContext(), Ops);
- }
+ if (IsIndirect)
+ Expr = DIExpression::prepend(Expr, DIExpression::WithDeref);
return BuildMI(BB, I, DL, Orig.getDesc())
.addFrameIndex(FrameIndex)
.addImm(Offset)
Modified: llvm/trunk/lib/IR/DebugInfoMetadata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfoMetadata.cpp?rev=301665&r1=301664&r2=301665&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfoMetadata.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfoMetadata.cpp Fri Apr 28 13:30:36 2017
@@ -672,11 +672,8 @@ void DIExpression::appendOffset(SmallVec
}
}
-DIExpression *DIExpression::prepend(DIExpression *Expr, bool Deref,
+DIExpression *DIExpression::prepend(const DIExpression *Expr, bool Deref,
int64_t Offset, bool StackValue) {
- if (!Deref && !Offset && !StackValue)
- return Expr;
-
SmallVector<uint64_t, 8> Ops;
appendOffset(Ops, Offset);
if (Deref)
More information about the llvm-commits
mailing list