[PATCH] D122166: [InstCombine] try to narrow shifted bswap-of-zext

Nathan Chancellor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 22 17:24:41 PDT 2022


nathanchance added a comment.

This patch causes a crash while building the Linux kernel for arm64. A simplifier C reproducer:

  $ cat csio_lnode.i
  struct csio_lnode {
    unsigned nport_id
  };
  csio_ln_vnp_read_cbfn_mbp_0;
  csio_ln_vnp_read_cbfn_rsp_0() {
    struct csio_lnode *ln = csio_ln_vnp_read_cbfn_mbp_0;
    int nport_id;
    memcpy(&nport_id, csio_ln_vnp_read_cbfn_rsp_0, 3);
    ln->nport_id =
        __builtin_constant_p(0) ? nport_id << 24 | (nport_id & 83040) >> 8 : 0;
    ln->nport_id = ln->nport_id >> 8;
  }
  
  $ clang --target=aarch64-linux-gnu -O2 -c -o /dev/null csio_lnode.i
  ...
  bswap must be an even number of bytes
    %3 = tail call i24 @llvm.bswap.i24(i24 %2)
  in function csio_ln_vnp_read_cbfn_rsp_0
  fatal error: error in backend: Broken function found, compilation aborted!
  PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
  Stack dump:
  0.      Program arguments: clang --target=aarch64-linux-gnu -O2 -c -o /dev/null csio_lnode.i
  1.      <eof> parser at end of file
  2.      Code generation
  3.      Running pass 'Function Pass Manager' on module 'csio_lnode.i'.
  4.      Running pass 'Module Verifier' on function '@csio_ln_vnp_read_cbfn_rsp_0'
  ...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122166/new/

https://reviews.llvm.org/D122166



More information about the llvm-commits mailing list