[llvm] r297200 - [GlobalISel] Emit DBG_VALUE %noreg for non-int/fp constant values.
Ahmed Bougacha via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 7 12:34:20 PST 2017
Author: ab
Date: Tue Mar 7 14:34:20 2017
New Revision: 297200
URL: http://llvm.org/viewvc/llvm-project?rev=297200&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
llvm/trunk/test/CodeGen/AArch64/GlobalISel/debug-insts.ll
Modified: llvm/trunk/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp?rev=297200&r1=297199&r2=297200&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp Tue Mar 7 14:34:20 2017
@@ -137,8 +137,13 @@ MachineInstrBuilder MachineIRBuilder::bu
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);
}
Modified: llvm/trunk/test/CodeGen/AArch64/GlobalISel/debug-insts.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/GlobalISel/debug-insts.ll?rev=297200&r1=297199&r2=297200&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/GlobalISel/debug-insts.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/GlobalISel/debug-insts.ll Tue Mar 7 14:34:20 2017
@@ -26,6 +26,8 @@ define void @debug_value(i32 %in) #0 !db
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
}
More information about the llvm-commits
mailing list