<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/63076>63076</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [DebugInfo][SelectionDAG] Missing bool assignment of return value at O1
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          OCHyams
      </td>
    </tr>
</table>

<pre>
    Variable `b` in repro.cpp has no debug variable location. It goes missing after SelectionDAG.

See on godbolt: https://godbolt.org/z/EcWEfP6vK

```
$ cat repro.cpp
bool get();
int fun() {
  bool b = get();
  return b;
}
```
```
$ clang repro.cpp -O1 -g --target=x86_64-unknown-unknown -o repro -c
```
```
$ llvm-dwarfdump repro --name fun --show-children

repro:  file format elf64-x86-64

0x00000023: DW_TAG_subprogram
 DW_AT_low_pc   (0x0000000000000000)
 DW_AT_high_pc  (0x000000000000000e)
 DW_AT_frame_base       (DW_OP_reg6 RBP)
 DW_AT_call_all_calls   (true)
 DW_AT_linkage_name     ("_Z3funv")
              DW_AT_name        ("fun")
 DW_AT_decl_file        ("repro.cpp")
 DW_AT_decl_line        (2)
              DW_AT_type        (0x0000004f "int")
 DW_AT_external (true)

0x00000033:   DW_TAG_variable
 DW_AT_name     ("b")
 DW_AT_decl_file        ("repro.cpp")
                DW_AT_decl_line (3)
 DW_AT_type     (0x0000004b "bool")

0x0000003b: DW_TAG_call_site
                DW_AT_call_origin       (0x00000042)
 DW_AT_call_return_pc   (0x0000000000000009)

0x00000041: NULL
```
```
$  llvm-objdump --disassemble-symbols=_Z3funv repro

repro:  file format elf64-x86-64

Disassembly of section .text:

0000000000000000 <_Z3funv>:
       0: 55    pushq   %rbp
       1: 48 89 e5                      movq    %rsp, %rbp
       4: e8 00 00 00 00                callq   0x9 <_Z3funv+0x9>
 9: 0f b6 c0                            movzbl  %al, %eax
       c: 5d    popq    %rbp
       d: c3    retq
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVtGPm7gT_muclxGRYwOBhzzslqa_6te7ra69W-lekA2GuDU2tU0227_-ZEg2Cc1WlWqRkJhvPs98njHDnJOtFmKDknuUFAs2-J2xm4c3_3tmnVtwUz9v_mFWMq4EoBRzlGKQGqzorVlWfQ875kAbqAUfWtifoMpUzEujl_DeQ2uEg046J3ULrPHCwiehRBUAxd27JcIFwnfT9ychwGhoTc2N8ojewc773iF6h8gWke3xwdLYFpHtd0S2b6vHt83HdP__SxqU4uM1_SUxVMyf3Z6muTEKWuERyRDJEb2fpqX20Ax6mgW0Pk4DjHgOiBY3rACs8IPVwF-m0Lq47c4N7xTT7YWs0cMKohaiyDMb1qLFIUvLNI4G_VWbJ326Q2QmK4iqX11LqX0X1U_MNvXQ9SfzSLNOhLghitzOPEXVTqraCn2p64gNm4HzRioBjbEd8yBUk8bRIUujNL6E4wMeB6FhJ4vH8vPdu9INvLemtaw7Clc8lnefS2Weyr5COEckO9mdR1D6Er2T7e51uJjDG8s6UXLmxGRRPJYPH0sr2hT-uv84R1dMqTJ8wg83WXg7_MCqpP7KWlEG5SYUIqT8lzaD3iNCzvCrMdle2YzZRub0tahUGWR-wZ3z9xW0kvqI_vnq_rkX19rFDSBCpPY3qMXBC6uZuqHE9T7TcZ_htNOn4-CK7Cpw_hthw63AZirQOfmNwHkIPJT2JfssLn6Rv2N2OOnFz_wYQcbKVurZcj_EO0Kns-P1jM5f8SxeBc_-_PvDh1-t_qn8Df8yFn8U1dIx50THlYjcc8eNcogWxyyeDoffOAGKF_ZnMA246dSHpRcHP7JchDQbgOibUzHRty_go8w4xJ0kgHDeD273bdQtsby_Qo3qxBlkOYhkvlPjQDjvzP5k7npE3sANojgQiQwwPl8_EIWdDEz4kF86T-7xIQ8hTIR5oMIN8BSqOcmlT9_5VHAJU0enBDtcOVWNGtSjBqZ_RYI6gCoaQFb4b7O8WNQbWuc0ZwuxWaV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