[all-commits] [llvm/llvm-project] c17347: [llvm][DebugInfo] Emit DW_OP_lit0/1 for constant b...

Laxman Sole via All-commits all-commits at lists.llvm.org
Mon Sep 8 02:28:43 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c1734763ce89ba053752482682f64fd812d25a50
      https://github.com/llvm/llvm-project/commit/c1734763ce89ba053752482682f64fd812d25a50
  Author: Laxman Sole <lsole at nvidia.com>
  Date:   2025-09-08 (Mon, 08 Sep 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:
  -----------
  [llvm][DebugInfo] Emit DW_OP_lit0/1 for constant boolean values (#157167)

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_lit0; 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