Skip to content

[aarch64] Unknown FP condition! #86917

New issue

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

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

Already on GitHub? # to your account

Closed
DigOrDog opened this issue Mar 28, 2024 · 3 comments · Fixed by #86972
Closed

[aarch64] Unknown FP condition! #86917

DigOrDog opened this issue Mar 28, 2024 · 3 comments · Fixed by #86972

Comments

@DigOrDog
Copy link

Description

The following code crashes aarch64 backend with "Unknown FP condition!"

Minimal Reproduction

https://godbolt.org/z/7EeccGP3r

Code

; ModuleID = 'crash-4f3ab3a32f91d152361bae65ffeca42d2fa3e7b9'
source_filename = "M"

define float @f(i1 %0, i16 %1) {
BB:
  %RP = alloca float, align 4
  br label %BB2

BB2:                                              ; preds = %BB2, %BB
  %C2 = fcmp true float 4.200000e+01, 4.200000e+01
  %B2 = and i1 %C2, %0
  %2 = load float, ptr %RP, align 4
  br i1 %B2, label %BB2, label %BB1
BB1:                                              ; preds = %BB2
  ret float %2
}

Stack Trace

Unknown FP condition!
UNREACHABLE executed at /root/llvm-project/llvm/lib/Target/AArch64/GISel/AArch64GlobalISelUtils.cpp:105!
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-assertions-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -mtriple=aarch64 -O=0 <source>
1.	Running pass 'Function Pass Manager' on module '<source>'.
2.	Running pass 'InstructionSelect' on function '@f'
 #0 0x0000000003928f08 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3928f08)
 #1 0x000000000392665c SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f2211a42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00007f2211a969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x00007f2211a42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x00007f2211a287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x000000000387521a (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x387521a)
 #7 0x0000000000cc2500 llvm::AArch64GISelUtils::changeVectorFCMPPredToAArch64CC(llvm::CmpInst::Predicate, llvm::AArch64CC::CondCode&, llvm::AArch64CC::CondCode&, bool&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0xcc2500)
 #8 0x0000000000a8af3c (anonymous namespace)::AArch64InstructionSelector::selectCompareBranch(llvm::MachineInstr&, llvm::MachineFunction&, llvm::MachineRegisterInfo&) (.isra.0) AArch64InstructionSelector.cpp:0:0
 #9 0x0000000000a9085d (anonymous namespace)::AArch64InstructionSelector::select(llvm::MachineInstr&) AArch64InstructionSelector.cpp:0:0
#10 0x00000000040d02a9 llvm::InstructionSelect::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x40d02a9)
#11 0x0000000002942d31 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#12 0x0000000002f01813 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2f01813)
#13 0x0000000002f01a51 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2f01a51)
#14 0x0000000002f022b5 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2f022b5)
#15 0x000000000082323c compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#16 0x00000000007223e6 main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x7223e6)
#17 0x00007f2211a29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#18 0x00007f2211a29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#19 0x0000000000819d5e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x819d5e)
Program terminated with signal: SIGSEGV
Compiler returned: 139
@llvmbot
Copy link
Member

llvmbot commented Mar 28, 2024

@llvm/issue-subscribers-backend-aarch64

Author: None (DigOrDog)

# Description The following code crashes aarch64 backend with "Unknown FP condition!"

Minimal Reproduction

https://godbolt.org/z/7EeccGP3r

Code

; ModuleID = 'crash-4f3ab3a32f91d152361bae65ffeca42d2fa3e7b9'
source_filename = "M"

define float @<!-- -->f(i1 %0, i16 %1) {
BB:
  %RP = alloca float, align 4
  br label %BB2

BB2:                                              ; preds = %BB2, %BB
  %C2 = fcmp true float 4.200000e+01, 4.200000e+01
  %B2 = and i1 %C2, %0
  %2 = load float, ptr %RP, align 4
  br i1 %B2, label %BB2, label %BB1
BB1:                                              ; preds = %BB2
  ret float %2
}

Stack Trace

Unknown FP condition!
UNREACHABLE executed at /root/llvm-project/llvm/lib/Target/AArch64/GISel/AArch64GlobalISelUtils.cpp:105!
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-assertions-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -mtriple=aarch64 -O=0 &lt;source&gt;
1.	Running pass 'Function Pass Manager' on module '&lt;source&gt;'.
2.	Running pass 'InstructionSelect' on function '@<!-- -->f'
 #<!-- -->0 0x0000000003928f08 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3928f08)
 #<!-- -->1 0x000000000392665c SignalHandler(int) Signals.cpp:0:0
 #<!-- -->2 0x00007f2211a42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #<!-- -->3 0x00007f2211a969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #<!-- -->4 0x00007f2211a42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #<!-- -->5 0x00007f2211a287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #<!-- -->6 0x000000000387521a (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x387521a)
 #<!-- -->7 0x0000000000cc2500 llvm::AArch64GISelUtils::changeVectorFCMPPredToAArch64CC(llvm::CmpInst::Predicate, llvm::AArch64CC::CondCode&amp;, llvm::AArch64CC::CondCode&amp;, bool&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0xcc2500)
 #<!-- -->8 0x0000000000a8af3c (anonymous namespace)::AArch64InstructionSelector::selectCompareBranch(llvm::MachineInstr&amp;, llvm::MachineFunction&amp;, llvm::MachineRegisterInfo&amp;) (.isra.0) AArch64InstructionSelector.cpp:0:0
 #<!-- -->9 0x0000000000a9085d (anonymous namespace)::AArch64InstructionSelector::select(llvm::MachineInstr&amp;) AArch64InstructionSelector.cpp:0:0
#<!-- -->10 0x00000000040d02a9 llvm::InstructionSelect::runOnMachineFunction(llvm::MachineFunction&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x40d02a9)
#<!-- -->11 0x0000000002942d31 llvm::MachineFunctionPass::runOnFunction(llvm::Function&amp;) (.part.0) MachineFunctionPass.cpp:0:0
#<!-- -->12 0x0000000002f01813 llvm::FPPassManager::runOnFunction(llvm::Function&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2f01813)
#<!-- -->13 0x0000000002f01a51 llvm::FPPassManager::runOnModule(llvm::Module&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2f01a51)
#<!-- -->14 0x0000000002f022b5 llvm::legacy::PassManagerImpl::run(llvm::Module&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2f022b5)
#<!-- -->15 0x000000000082323c compileModule(char**, llvm::LLVMContext&amp;) llc.cpp:0:0
#<!-- -->16 0x00000000007223e6 main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x7223e6)
#<!-- -->17 0x00007f2211a29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#<!-- -->18 0x00007f2211a29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#<!-- -->19 0x0000000000819d5e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x819d5e)
Program terminated with signal: SIGSEGV
Compiler returned: 139

@tschuett
Copy link

The switch in:

void AArch64GISelUtils::changeFCMPPredToAArch64CC(

is missing support for FCMP_FALSE and FCMP_TRUE.

@marcauberer
Copy link
Member

I can confirm that this fixes the issue. Preparing a patch ...

@marcauberer marcauberer self-assigned this Mar 28, 2024
marcauberer added a commit that referenced this issue Mar 28, 2024
…tion (#86972)

Fixes #86917

`FCMP_TRUE` and `FCMP_FALSE` were previously not considered and we ended
up in an llvm_unreachable assertion.
llvmbot pushed a commit to llvmbot/llvm-project that referenced this issue May 5, 2024
…tion (llvm#86972)

Fixes llvm#86917

`FCMP_TRUE` and `FCMP_FALSE` were previously not considered and we ended
up in an llvm_unreachable assertion.

(cherry picked from commit c482fad)
marcauberer added a commit to marcauberer/llvm-project that referenced this issue May 9, 2024
…tion (llvm#86972)

Fixes llvm#86917

`FCMP_TRUE` and `FCMP_FALSE` were previously not considered and we ended
up in an llvm_unreachable assertion.
tstellar pushed a commit to marcauberer/llvm-project that referenced this issue May 9, 2024
…tion (llvm#86972)

Fixes llvm#86917

`FCMP_TRUE` and `FCMP_FALSE` were previously not considered and we ended
up in an llvm_unreachable assertion.
tstellar pushed a commit that referenced this issue May 9, 2024
…tion (#86972) (#91580)

Fixes #86917

`FCMP_TRUE` and `FCMP_FALSE` were previously not considered and we ended up in an llvm_unreachable assertion.
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants