<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Incorrect call site values for parameters produced by MOVZXi on AArch64"
   href="https://bugs.llvm.org/show_bug.cgi?id=43975">43975</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Incorrect call site values for parameters produced by MOVZXi on AArch64
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>DebugInfo
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>david.stenberg@ericsson.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jdevlieghere@apple.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Reproduced on 636412bf31fc4285d63faeea67e4d71e44e3799c.

Compiling the following code:

    #include <stdint.h>

    extern void call1(int64_t);
    extern void call2(int64_t);
    extern void call3(int64_t);
    extern void call4(int64_t);

    void caller() {
      call1(UINT64_C(1) << 0);
      call2(UINT64_C(1) << 16);
      call3(UINT64_C(1) << 32);
      call4(UINT64_C(1) << 48);
    }

using the following command:

    clang movz.c --target=aarch64 -O1 -g -Xclang -femit-debug-entry-values -c

gives the following call site entries for the calls to call[1-4]:

    $ llvm-dwarfdump movz.o | grep -E '(abstract_origin|call_site_value)'
                  DW_AT_abstract_origin (0x0000002a "call1")
                    DW_AT_GNU_call_site_value   (DW_OP_lit1)
                  DW_AT_abstract_origin (0x0000003e "call2")
                    DW_AT_GNU_call_site_value   (DW_OP_constu 0x10000)
                  DW_AT_abstract_origin (0x0000004b "call3")
                    DW_AT_GNU_call_site_value   (DW_OP_lit1)
                  DW_AT_abstract_origin (0x00000058 "call4")
                    DW_AT_GNU_call_site_value   (DW_OP_constu 0x10000)

As seen, the values passed to call3 and call4 are incorrect; 1 instead of
0x100000000 and 0x10000 instead of 0x1000000000000.

The issue seems to be that in AArch64InstrInfo::describeLoadedValue() a 32-bit
shift is used when calculating the immediate:

    5762     int Immediate = MI.getOperand(1).getImm();
    5763     int Shift = MI.getOperand(2).getImm();
    5764     return ParamLoadedValue(MachineOperand::CreateImm(Immediate <<
Shift),
    5765                             nullptr);</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>