[all-commits] [llvm/llvm-project] 3aae4b: Emit DW_OP_lit0/1 for constant boolean values (#15...

Laxman Sole via All-commits all-commits at lists.llvm.org
Sat Aug 30 02:07:35 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3aae4bd13dc4dd2e983b1fa11e1b8c0bf153ed14
      https://github.com/llvm/llvm-project/commit/3aae4bd13dc4dd2e983b1fa11e1b8c0bf153ed14
  Author: Laxman Sole <laxmansole at gmail.com>
  Date:   2025-08-30 (Sat, 30 Aug 2025)

  Changed paths:
    M llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    M llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
    M llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h
    A llvm/test/DebugInfo/debug-bool-const-location.ll

  Log Message:
  -----------
  Emit DW_OP_lit0/1 for constant boolean values (#155539)

Backends like NVPTX use -1 to indicate `true` and 0 to indicate `false`
for boolean values. Machine instruction `#DBG_VALUE` also uses -1 to
indicate a `true` boolean constant.

However, during the DWARF generation, booleans are treated as unsigned
variables, and the debug_loc expression, like `DW_OP_lit0; DW_OP_not` is
emitted for the `true` value.

This leads to the debugger printing `255` instead of `true` for constant
boolean variables.

This change emits `DW_OP_lit1` instead of `DW_OP_lot0; DW_OP_not`.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list