[PATCH] D113219: [RISCV] Prevent crashes when bitcasting between fixed vectors and scalars.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 10 12:00:07 PST 2021


craig.topper added a comment.

In D113219#3122231 <https://reviews.llvm.org/D113219#3122231>, @foad wrote:

> This causes a crash in lit testing in my LLVM_ENABLE_EXPENSIVE_CHECKS build:
>
>   $ git checkout main~13 && ninja -C ~/llvm-expensive/ llc && ~/llvm-release/bin/llvm-lit -s -vv test/CodeGen/RISCV/rvv/fixed-vectors-bitcast.ll
>   Previous HEAD position was 48bb5f4cbe8d [clang] Add early exit when checking for const init of arrays.
>   HEAD is now at 57bc7b108937 [RISCV] Prevent crashes when bitcasting between fixed vectors and scalars.
>   ninja: Entering directory `/home/jayfoad2/llvm-expensive/'
>   [4/4] Linking CXX executable bin/llc
>   FAIL: LLVM :: CodeGen/RISCV/rvv/fixed-vectors-bitcast.ll (1 of 1)
>   ******************** TEST 'LLVM :: CodeGen/RISCV/rvv/fixed-vectors-bitcast.ll' FAILED ********************
>   Script:
>   --
>   : 'RUN: at line 2';   /home/jayfoad2/llvm-release/bin/llc -mtriple=riscv32 -mattr=+experimental-v,+d,+experimental-zfh -verify-machineinstrs      -riscv-v-vector-bits-min=128 -target-abi=ilp32d < /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-bitcast.ll      | /home/jayfoad2/llvm-release/bin/FileCheck /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-bitcast.ll --check-prefixes=CHECK,RV32
>   : 'RUN: at line 5';   /home/jayfoad2/llvm-release/bin/llc -mtriple=riscv64 -mattr=+experimental-v,+d,+experimental-zfh -verify-machineinstrs      -riscv-v-vector-bits-min=128 -target-abi=lp64d < /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-bitcast.ll      | /home/jayfoad2/llvm-release/bin/FileCheck /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-bitcast.ll --check-prefixes=CHECK,RV64
>   : 'RUN: at line 8';   /home/jayfoad2/llvm-release/bin/llc -mtriple=riscv32 -mattr=+experimental-v,+d,+experimental-zfh -verify-machineinstrs      -riscv-v-vector-bits-min=128      -riscv-v-fixed-length-vector-elen-max=32 -target-abi=ilp32d < /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-bitcast.ll      | /home/jayfoad2/llvm-release/bin/FileCheck /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-bitcast.ll --check-prefixes=ELEN32,RV32ELEN32
>   : 'RUN: at line 12';   /home/jayfoad2/llvm-release/bin/llc -mtriple=riscv64 -mattr=+experimental-v,+d,+experimental-zfh -verify-machineinstrs      -riscv-v-vector-bits-min=128      -riscv-v-fixed-length-vector-elen-max=32 -target-abi=lp64d < /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-bitcast.ll      | /home/jayfoad2/llvm-release/bin/FileCheck /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-bitcast.ll --check-prefixes=ELEN32,RV64ELEN32
>   --
>   Exit Code: 1
>   
>   Command Output (stderr):
>   --
>   + : 'RUN: at line 2'
>   + /home/jayfoad2/llvm-release/bin/llc -mtriple=riscv32 -mattr=+experimental-v,+d,+experimental-zfh -verify-machineinstrs -riscv-v-vector-bits-min=128 -target-abi=ilp32d
>   + /home/jayfoad2/llvm-release/bin/FileCheck /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-bitcast.ll --check-prefixes=CHECK,RV32
>   + : 'RUN: at line 5'
>   + /home/jayfoad2/llvm-release/bin/llc -mtriple=riscv64 -mattr=+experimental-v,+d,+experimental-zfh -verify-machineinstrs -riscv-v-vector-bits-min=128 -target-abi=lp64d
>   + /home/jayfoad2/llvm-release/bin/FileCheck /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-bitcast.ll --check-prefixes=CHECK,RV64
>   + : 'RUN: at line 8'
>   + /home/jayfoad2/llvm-release/bin/llc -mtriple=riscv32 -mattr=+experimental-v,+d,+experimental-zfh -verify-machineinstrs -riscv-v-vector-bits-min=128 -riscv-v-fixed-length-vector-elen-max=32 -target-abi=ilp32d
>   + /home/jayfoad2/llvm-release/bin/FileCheck /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-bitcast.ll --check-prefixes=ELEN32,RV32ELEN32
>   llc: /home/jayfoad2/git/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:979: void (anonymous namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDNode *): Assertion `(TLI.getTypeAction(*DAG.getContext(), Op.getValueType()) == TargetLowering::TypeLegal || Op.getOpcode() == ISD::TargetConstant || Op.getOpcode() == ISD::Register) && "Unexpected illegal type!"' failed.
>   PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
>   Stack dump:
>   0.	Program arguments: /home/jayfoad2/llvm-release/bin/llc -mtriple=riscv32 -mattr=+experimental-v,+d,+experimental-zfh -verify-machineinstrs -riscv-v-vector-bits-min=128 -riscv-v-fixed-length-vector-elen-max=32 -target-abi=ilp32d
>   1.	Running pass 'Function Pass Manager' on module '<stdin>'.
>   2.	Running pass 'RISCV DAG->DAG Pattern Instruction Selection' on function '@bitcast_v8i8_f64'
>    #0 0x00000000052aa793 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/jayfoad2/llvm-release/bin/llc+0x52aa793)
>    #1 0x00000000052a84de llvm::sys::RunSignalHandlers() (/home/jayfoad2/llvm-release/bin/llc+0x52a84de)
>    #2 0x00000000052aab1f SignalHandler(int) Signals.cpp:0:0
>    #3 0x00007fd1cbd723c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
>    #4 0x00007fd1cb80618b raise /build/glibc-eX1tMB/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
>    #5 0x00007fd1cb7e5859 abort /build/glibc-eX1tMB/glibc-2.31/stdlib/abort.c:81:7
>    #6 0x00007fd1cb7e5729 get_sysdep_segment_value /build/glibc-eX1tMB/glibc-2.31/intl/loadmsgcat.c:509:8
>    #7 0x00007fd1cb7e5729 _nl_load_domain /build/glibc-eX1tMB/glibc-2.31/intl/loadmsgcat.c:970:34
>    #8 0x00007fd1cb7f6f36 (/lib/x86_64-linux-gnu/libc.so.6+0x36f36)
>    #9 0x0000000004fcc33a (anonymous namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*) LegalizeDAG.cpp:0:0
>   #10 0x0000000004fcc08a llvm::SelectionDAG::Legalize() (/home/jayfoad2/llvm-release/bin/llc+0x4fcc08a)
>   #11 0x00000000050d953c llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/home/jayfoad2/llvm-release/bin/llc+0x50d953c)
>   #12 0x00000000050d73be llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/home/jayfoad2/llvm-release/bin/llc+0x50d73be)
>   #13 0x00000000050d3dfa llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/home/jayfoad2/llvm-release/bin/llc+0x50d3dfa)
>   #14 0x00000000045fd29e llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/home/jayfoad2/llvm-release/bin/llc+0x45fd29e)
>   #15 0x0000000004a48fa8 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/jayfoad2/llvm-release/bin/llc+0x4a48fa8)
>   #16 0x0000000004a4f7a8 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/jayfoad2/llvm-release/bin/llc+0x4a4f7a8)
>   #17 0x0000000004a49657 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/jayfoad2/llvm-release/bin/llc+0x4a49657)
>   #18 0x0000000002ee12cc main (/home/jayfoad2/llvm-release/bin/llc+0x2ee12cc)
>   #19 0x00007fd1cb7e70b3 __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:342:3
>   #20 0x0000000002ede7ce _start (/home/jayfoad2/llvm-release/bin/llc+0x2ede7ce)
>   /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-bitcast.ll:262:17: error: ELEN32-LABEL: expected string not found in input
>   ; ELEN32-LABEL: bitcast_v1i64_i64:
>                   ^
>   <stdin>:130:19: note: scanning from here
>   bitcast_v2i32_i64: # @bitcast_v2i32_i64
>                     ^
>   <stdin>:130:23: note: possible intended match here
>   bitcast_v2i32_i64: # @bitcast_v2i32_i64
>                         ^
>   
>   Input file: <stdin>
>   Check file: /home/jayfoad2/git/llvm-project/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-bitcast.ll
>   
>   -dump-input=help explains the following input dump.
>   
>   Input was:
>   <<<<<<
>                .
>                .
>                .
>              125:  .cfi_endproc 
>              126:  # -- End function 
>              127:  .globl bitcast_v2i32_i64 # -- Begin function bitcast_v2i32_i64 
>              128:  .p2align 2 
>              129:  .type bitcast_v2i32_i64, at function 
>              130: bitcast_v2i32_i64: # @bitcast_v2i32_i64 
>   label:262'0                       X~~~~~~~~~~~~~~~~~~~~~ error: no match found
>   label:262'1                           ?                  possible intended match
>              131:  .cfi_startproc 
>   label:262'0     ~~~~~~~~~~~~~~~~
>              132: # %bb.0: 
>   label:262'0     ~~~~~~~~~
>              133:  vsetivli zero, 1, e32, m
>   label:262'0     ~~~~~~~~~~~~~~~~~~~~~~~~~
>   >>>>>>
>   
>   --
>   
>   ********************
>   ********************
>   Failed Tests (1):
>     LLVM :: CodeGen/RISCV/rvv/fixed-vectors-bitcast.ll
>   
>   
>   Testing Time: 0.20s
>     Failed: 1

I haven't had luck reproducing that error yet, but enabling expensive checks did find another problem that I fixed in 9ee5cec688add4c0589a8ff08f49e274fa6d45a2 <https://reviews.llvm.org/rG9ee5cec688add4c0589a8ff08f49e274fa6d45a2>. Maybe that will fix your crash too?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113219



More information about the llvm-commits mailing list