aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CodeGenPrepare.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index f4bf55d..6e806b0 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -2883,11 +2883,8 @@ class TypePromotionTransaction {
// including the debug uses. Since we are undoing the replacements,
// the original debug uses must also be reinstated to maintain the
// correctness and utility of debug value instructions.
- for (auto *DVI: DbgValues) {
- LLVMContext &Ctx = Inst->getType()->getContext();
- auto *MV = MetadataAsValue::get(Ctx, ValueAsMetadata::get(Inst));
- DVI->setOperand(0, MV);
- }
+ for (auto *DVI : DbgValues)
+ DVI->replaceVariableLocationOp(DVI->getVariableLocationOp(0), Inst);
}
};
@@ -7878,7 +7875,7 @@ bool CodeGenPrepare::fixupDbgValue(Instruction *I) {
DbgValueInst &DVI = *cast<DbgValueInst>(I);
// Does this dbg.value refer to a sunk address calculation?
- Value *Location = DVI.getVariableLocation();
+ Value *Location = DVI.getVariableLocationOp(0);
WeakTrackingVH SunkAddrVH = SunkAddrs[Location];
Value *SunkAddr = SunkAddrVH.pointsToAliveValue() ? SunkAddrVH : nullptr;
if (SunkAddr) {
@@ -7886,8 +7883,7 @@ bool CodeGenPrepare::fixupDbgValue(Instruction *I) {
// opportunity to be accurately lowered. This update may change the type of
// pointer being referred to; however this makes no difference to debugging
// information, and we can't generate bitcasts that may affect codegen.
- DVI.setOperand(0, MetadataAsValue::get(DVI.getContext(),
- ValueAsMetadata::get(SunkAddr)));
+ DVI.replaceVariableLocationOp(Location, SunkAddr);
return true;
}
return false;