summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmed Bougacha <ahmed.bougacha@gmail.com>2017-03-07 20:34:20 +0000
committerAhmed Bougacha <ahmed.bougacha@gmail.com>2017-03-07 20:34:20 +0000
commit4826bae8b493a38c98b29ef833bb4e7244019ebd (patch)
tree28113ee73576b42be2f0d07c09fd04dee8282176
parentab50ecb1c7821b9cf4e564b96fed071aa6c8942a (diff)
downloadbcm5719-llvm-4826bae8b493a38c98b29ef833bb4e7244019ebd.tar.gz
bcm5719-llvm-4826bae8b493a38c98b29ef833bb4e7244019ebd.zip
[GlobalISel] Emit DBG_VALUE %noreg for non-int/fp constant values.
When a dbg_value has a constant operand that isn't representable in MI, there isn't much we can do. Use %noreg (0) for those situations. This matches the SelectionDAG behavior. llvm-svn: 297200
-rw-r--r--llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp7
-rw-r--r--llvm/test/CodeGen/AArch64/GlobalISel/debug-insts.ll2
2 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp b/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
index 3614333037c..8630ef842b4 100644
--- a/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
@@ -137,8 +137,13 @@ MachineInstrBuilder MachineIRBuilder::buildConstDbgValue(const Constant &C,
MIB.addCImm(CI);
else
MIB.addImm(CI->getZExtValue());
- } else
+ } else if (auto *CFP = dyn_cast<ConstantFP>(&C)) {
+ assert(isa<ConstantFP>(C) && "Unexpected constant dbg value");
MIB.addFPImm(&cast<ConstantFP>(C));
+ } else {
+ // Insert %noreg if we didn't find a usable constant and had to drop it.
+ MIB.addReg(0U);
+ }
return MIB.addImm(Offset).addMetadata(Variable).addMetadata(Expr);
}
diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/debug-insts.ll b/llvm/test/CodeGen/AArch64/GlobalISel/debug-insts.ll
index ffd2c0c68b1..2c3def2e4a9 100644
--- a/llvm/test/CodeGen/AArch64/GlobalISel/debug-insts.ll
+++ b/llvm/test/CodeGen/AArch64/GlobalISel/debug-insts.ll
@@ -26,6 +26,8 @@ define void @debug_value(i32 %in) #0 !dbg !7 {
call void @llvm.dbg.value(metadata i32 123, i64 0, metadata !11, metadata !12), !dbg !13
; CHECK: DBG_VALUE float 1.000000e+00, 0, !11, !12, debug-location !13
call void @llvm.dbg.value(metadata float 1.000000e+00, i64 0, metadata !11, metadata !12), !dbg !13
+; CHECK: DBG_VALUE _, 0, !11, !12, debug-location !13
+ call void @llvm.dbg.value(metadata i32* null, i64 0, metadata !11, metadata !12), !dbg !13
ret void
}
OpenPOWER on IntegriCloud