Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LLVM ERROR: Cannot select: 0x89658f0: ch = store<(store (s16) into ptr undef), trunc to bf16> 0x8965ea0, 0x8965dc0, undef:i64, undef:i64 #91892

Open
DigOrDog opened this issue May 12, 2024 · 1 comment
Labels
backend:AArch64 crash Prefer [crash-on-valid] or [crash-on-invalid]

Comments

@DigOrDog
Copy link

Description

The following code generated by a Fuzzer tool causes crashes in LLVM Compiler (LLC) versions 17.0.1 and 18.1.0. The error message is as follows: "LLVM ERROR: Cannot select: 0x8d60da0: ch = store<(store (s16) into ptr undef), trunc to bf16> 0x8d61350, 0x8d61270, undef:i64, undef:i64."

Minimal Reproduction

https://godbolt.org/z/K131ef86s

code

; ModuleID = 'Fuzzer input'
source_filename = "M"

@G = global i1 true
@G.1 = global i2 1
@G.2 = global float 0x7FF8000000000000

define i32 @f() {
BB:
  %LGV = load i1, ptr @G, align 1
  %CastExt = zext i1 %LGV to i2
  %RP = alloca i32, align 4
  %Castaddrspacecast1 = addrspacecast ptr %RP to ptr addrspace(1)
  %L = load i8, ptr addrspace(1) %Castaddrspacecast1, align 1
  %0 = load i32, ptr %RP, align 4
  store ptr addrspace(1) %Castaddrspacecast1, ptr undef, align 8
  store i2 %CastExt, ptr @G.1, align 1
  %CastIToFP = uitofp i8 %L to float
  store float %CastIToFP, ptr @G.2, align 4
  %CastFPTrunc = fptrunc float %CastIToFP to bfloat
  store bfloat %CastFPTrunc, ptr undef, align 2
  ret i32 %0
}

Stack Trace

LLVM ERROR: Cannot select: 0x8d60da0: ch = store<(store (s16) into `ptr undef`), trunc to bf16> 0x8d61350, 0x8d61270, undef:i64, undef:i64
  0x8d61270: f32 = uint_to_fp 0x8d61430
    0x8d61430: i32,ch = load<(dereferenceable load (s8) from %ir.Castaddrspacecast1, addrspace 1), zext from i8> 0x8d023a0, FrameIndex:i64<0>, undef:i64
      0x8d60f60: i64 = FrameIndex<0>
      0x8d60e10: i64 = undef
  0x8d60e10: i64 = undef
  0x8d60e10: i64 = undef
In function: f
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-18.1.0/bin/llc -o /app/output.s -x86-asm-syntax=intel -mtriple aarch64 -global-isel -O0 <source>
1.	Running pass 'Function Pass Manager' on module '<source>'.
2.	Running pass 'AArch64 Instruction Selection' on function '@f'
 #0 0x00000000034ca4a8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-18.1.0/bin/llc+0x34ca4a8)
 #1 0x00000000034c7e1c SignalHandler(int) Signals.cpp:0:0
 #2 0x0000752347842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00007523478969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x0000752347842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x00007523478287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x0000000000716f82 llvm::RISCVISAInfo::updateCombination() (.cold) RISCVISAInfo.cpp:0:0
 #7 0x00000000032a1bc4 llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (/opt/compiler-explorer/clang-18.1.0/bin/llc+0x32a1bc4)
 #8 0x00000000032a7b85 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/opt/compiler-explorer/clang-18.1.0/bin/llc+0x32a7b85)
 #9 0x0000000000afc2cd (anonymous namespace)::AArch64DAGToDAGISel::Select(llvm::SDNode*) AArch64ISelDAGToDAG.cpp:0:0
#10 0x000000000329f147 llvm::SelectionDAGISel::DoInstructionSelection() (/opt/compiler-explorer/clang-18.1.0/bin/llc+0x329f147)
#11 0x00000000032ac465 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-18.1.0/bin/llc+0x32ac465)
#12 0x00000000032af12f llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-18.1.0/bin/llc+0x32af12f)
#13 0x00000000032b1819 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) SelectionDAGISel.cpp:0:0
#14 0x000000000262f530 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#15 0x0000000002b425d2 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-18.1.0/bin/llc+0x2b425d2)
#16 0x0000000002b42751 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-18.1.0/bin/llc+0x2b42751)
#17 0x0000000002b443d0 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-18.1.0/bin/llc+0x2b443d0)
#18 0x00000000008126b4 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#19 0x0000000000728816 main (/opt/compiler-explorer/clang-18.1.0/bin/llc+0x728816)
#20 0x0000752347829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#21 0x0000752347829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#22 0x000000000080a31e _start (/opt/compiler-explorer/clang-18.1.0/bin/llc+0x80a31e)
Program terminated with signal: SIGSEGV
Compiler returned: 139
@llvmbot
Copy link
Collaborator

llvmbot commented May 12, 2024

@llvm/issue-subscribers-backend-aarch64

Author: None (DigOrDog)

# Description The following code generated by a Fuzzer tool causes crashes in LLVM Compiler (LLC) versions 17.0.1 and 18.1.0. The error message is as follows: "LLVM ERROR: Cannot select: 0x8d60da0: ch = store<(store (s16) into ptr undef), trunc to bf16> 0x8d61350, 0x8d61270, undef:i64, undef:i64."

Minimal Reproduction

https://godbolt.org/z/K131ef86s

code

; ModuleID = 'Fuzzer input'
source_filename = "M"

@<!-- -->G = global i1 true
@<!-- -->G.1 = global i2 1
@<!-- -->G.2 = global float 0x7FF8000000000000

define i32 @<!-- -->f() {
BB:
  %LGV = load i1, ptr @<!-- -->G, align 1
  %CastExt = zext i1 %LGV to i2
  %RP = alloca i32, align 4
  %Castaddrspacecast1 = addrspacecast ptr %RP to ptr addrspace(1)
  %L = load i8, ptr addrspace(1) %Castaddrspacecast1, align 1
  %0 = load i32, ptr %RP, align 4
  store ptr addrspace(1) %Castaddrspacecast1, ptr undef, align 8
  store i2 %CastExt, ptr @<!-- -->G.1, align 1
  %CastIToFP = uitofp i8 %L to float
  store float %CastIToFP, ptr @<!-- -->G.2, align 4
  %CastFPTrunc = fptrunc float %CastIToFP to bfloat
  store bfloat %CastFPTrunc, ptr undef, align 2
  ret i32 %0
}

Stack Trace

LLVM ERROR: Cannot select: 0x8d60da0: ch = store&lt;(store (s16) into `ptr undef`), trunc to bf16&gt; 0x8d61350, 0x8d61270, undef:i64, undef:i64
  0x8d61270: f32 = uint_to_fp 0x8d61430
    0x8d61430: i32,ch = load&lt;(dereferenceable load (s8) from %ir.Castaddrspacecast1, addrspace 1), zext from i8&gt; 0x8d023a0, FrameIndex:i64&lt;0&gt;, undef:i64
      0x8d60f60: i64 = FrameIndex&lt;0&gt;
      0x8d60e10: i64 = undef
  0x8d60e10: i64 = undef
  0x8d60e10: i64 = undef
In function: f
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-18.1.0/bin/llc -o /app/output.s -x86-asm-syntax=intel -mtriple aarch64 -global-isel -O0 &lt;source&gt;
1.	Running pass 'Function Pass Manager' on module '&lt;source&gt;'.
2.	Running pass 'AArch64 Instruction Selection' on function '@<!-- -->f'
 #<!-- -->0 0x00000000034ca4a8 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/opt/compiler-explorer/clang-18.1.0/bin/llc+0x34ca4a8)
 #<!-- -->1 0x00000000034c7e1c SignalHandler(int) Signals.cpp:0:0
 #<!-- -->2 0x0000752347842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #<!-- -->3 0x00007523478969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #<!-- -->4 0x0000752347842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #<!-- -->5 0x00007523478287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #<!-- -->6 0x0000000000716f82 llvm::RISCVISAInfo::updateCombination() (.cold) RISCVISAInfo.cpp:0:0
 #<!-- -->7 0x00000000032a1bc4 llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (/opt/compiler-explorer/clang-18.1.0/bin/llc+0x32a1bc4)
 #<!-- -->8 0x00000000032a7b85 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/opt/compiler-explorer/clang-18.1.0/bin/llc+0x32a7b85)
 #<!-- -->9 0x0000000000afc2cd (anonymous namespace)::AArch64DAGToDAGISel::Select(llvm::SDNode*) AArch64ISelDAGToDAG.cpp:0:0
#<!-- -->10 0x000000000329f147 llvm::SelectionDAGISel::DoInstructionSelection() (/opt/compiler-explorer/clang-18.1.0/bin/llc+0x329f147)
#<!-- -->11 0x00000000032ac465 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-18.1.0/bin/llc+0x32ac465)
#<!-- -->12 0x00000000032af12f llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&amp;) (/opt/compiler-explorer/clang-18.1.0/bin/llc+0x32af12f)
#<!-- -->13 0x00000000032b1819 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&amp;) (.part.0) SelectionDAGISel.cpp:0:0
#<!-- -->14 0x000000000262f530 llvm::MachineFunctionPass::runOnFunction(llvm::Function&amp;) (.part.0) MachineFunctionPass.cpp:0:0
#<!-- -->15 0x0000000002b425d2 llvm::FPPassManager::runOnFunction(llvm::Function&amp;) (/opt/compiler-explorer/clang-18.1.0/bin/llc+0x2b425d2)
#<!-- -->16 0x0000000002b42751 llvm::FPPassManager::runOnModule(llvm::Module&amp;) (/opt/compiler-explorer/clang-18.1.0/bin/llc+0x2b42751)
#<!-- -->17 0x0000000002b443d0 llvm::legacy::PassManagerImpl::run(llvm::Module&amp;) (/opt/compiler-explorer/clang-18.1.0/bin/llc+0x2b443d0)
#<!-- -->18 0x00000000008126b4 compileModule(char**, llvm::LLVMContext&amp;) llc.cpp:0:0
#<!-- -->19 0x0000000000728816 main (/opt/compiler-explorer/clang-18.1.0/bin/llc+0x728816)
#<!-- -->20 0x0000752347829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#<!-- -->21 0x0000752347829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#<!-- -->22 0x000000000080a31e _start (/opt/compiler-explorer/clang-18.1.0/bin/llc+0x80a31e)
Program terminated with signal: SIGSEGV
Compiler returned: 139

@EugeneZelenko EugeneZelenko added crash Prefer [crash-on-valid] or [crash-on-invalid] and removed new issue labels May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:AArch64 crash Prefer [crash-on-valid] or [crash-on-invalid]
Projects
None yet
Development

No branches or pull requests

4 participants