<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 - rG42f488b63a04 breaks arm64 kernel build with ThinLTO"
   href="https://bugs.llvm.org/show_bug.cgi?id=46523">46523</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>rG42f488b63a04 breaks arm64 kernel build with ThinLTO
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Scalar Optimizations
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>spatel+llvm@rotateright.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>samitolvanen@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, ndesaulniers@google.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=23658" name="attach_23658" title="kernel configuration">attachment 23658</a> <a href="attachment.cgi?id=23658&action=edit" title="kernel configuration">[details]</a></span>
kernel configuration

Commit 42f488b63a04fdaa931315bdadecb6d23e20529a ("[InstCombine] improve
matching for sext-lshr-trunc patterns") breaks the arm64 Linux kernel build
with ThinLTO.

Steps to reproduce:

$ git clone <a href="https://github.com/samitolvanen/linux.git">https://github.com/samitolvanen/linux.git</a>
$ cd linux
$ git checkout origin/clang-lto
$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- LLVM=1 defconfig
$ ./scripts/config -e LTO_CLANG -e NFP -e BPF_SYSCALL
$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- LLVM=1 olddefconfig
$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- LLVM=1 -j110
...
  LD      .tmp_vmlinux.kallsyms1
ld.lld: error: undefined symbol: __compiletime_assert_900
<span class="quote">>>> referenced by jit.c:653 (drivers/net/ethernet/netronome/nfp/bpf/jit.c:653)
>>>               vmlinux.o:(jeq_imm.llvm.9259135780514890817</span >
make: *** [Makefile:1161: vmlinux] Error 1

This is caused by compiletime_assert in the FIELD_FIT / __BF_FIELD_CHECK macro
in the function ur_load_imm_any, which is called in jeq_imm.

The code compiles fine without ThinLTO, or with the previous revision of LLVM
prior to this commit.

I have attached a .config that reproduces the error.</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>