[llvm] [llvm][DebugInfo] Emit 0/1 for constant boolean values (PR #151225)
Jeremy Morse via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 29 02:13:05 PDT 2025
================
@@ -733,6 +733,8 @@ MachineOperand GetMOForConstDbgOp(const SDDbgOperand &Op) {
if (const ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
if (CI->getBitWidth() > 64)
return MachineOperand::CreateCImm(CI);
+ if (CI->getBitWidth() == 1)
+ return MachineOperand::CreateImm(CI->getZExtValue());
----------------
jmorse wrote:
@arsenm I agree it's best to keep the convention for codegen; however I'd argue that this behaviour in this function isn't codegen, it's generating a debug-instruction that will (should) be ignored by every pieces of code that does codegen. In an ideal world we would be able to peel these two concerns (operand consistency for codegen; normalisation for debug-info) apart, and we're working towards that [0], but it's currently imperfect and this specialisation for debug-info will improve things in the meantime.
[0] https://discourse.llvm.org/t/psa-ir-output-changing-from-debug-intrinsics-to-debug-records/79578/11
https://github.com/llvm/llvm-project/pull/151225
More information about the llvm-commits
mailing list