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

[Hexagon] cannot select v8i1 = PTRUE or PFALSE as fcmp result #64970

Open
tinkerrc opened this issue Aug 25, 2023 · 3 comments
Open

[Hexagon] cannot select v8i1 = PTRUE or PFALSE as fcmp result #64970

tinkerrc opened this issue Aug 25, 2023 · 3 comments

Comments

@tinkerrc
Copy link
Contributor

Any IR code that contains a fcmp instruction that yields a boolean vector of all true or all false crashes llc.

Compiler Explorer - PFALSE demo
Compiler Explorer - PTRUE demo

PFALSE demo code:

@G = global <32 x i1> zeroinitializer

define void @test(<32 x half> %A) {
  %C = fcmp ogt <32 x half> %A, <half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00, half 0xH7C00>
  store <32 x i1> %C, ptr @G
  ret void
}

PFALSE demo backtrace:

LLVM ERROR: Cannot select: 0x84dfc80: v8i1 = HexagonISD::PFALSE
In function: test
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-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -mtriple=hexagon <source>
1.	Running pass 'Function Pass Manager' on module '<source>'.
2.	Running pass 'Hexagon DAG->DAG Pattern Instruction Selection' on function '@test'
 #0 0x0000000003079ed8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3079ed8)
 #1 0x000000000307782c SignalHandler(int) Signals.cpp:0:0
 #2 0x00007fbfcc14b420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #3 0x00007fbfcbc0e00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #4 0x00007fbfcbbed859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #5 0x000000000069e37a llvm::RISCVISAInfo::updateImplication() (.cold) RISCVISAInfo.cpp:0:0
 #6 0x0000000002e5ead4 llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2e5ead4)
 #7 0x0000000002e641ad llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2e641ad)
 #8 0x0000000002e5c137 llvm::SelectionDAGISel::DoInstructionSelection() (/opt/compiler-explorer/clang-trunk/bin/llc+0x2e5c137)
 #9 0x0000000002e68a65 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-trunk/bin/llc+0x2e68a65)
#10 0x0000000002e6b4b9 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2e6b4b9)
#11 0x0000000002e6db86 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) SelectionDAGISel.cpp:0:0
#12 0x000000000124ba66 llvm::HexagonDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x124ba66)
#13 0x0000000002458b10 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#14 0x00000000029350e2 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x29350e2)
#15 0x0000000002935261 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2935261)
#16 0x0000000002936dd0 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2936dd0)
#17 0x00000000007640c0 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#18 0x00000000006a9122 main (/opt/compiler-explorer/clang-trunk/bin/llc+0x6a9122)
#19 0x00007fbfcbbef083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#20 0x000000000075c00e _start (/opt/compiler-explorer/clang-trunk/bin/llc+0x75c00e)
Program terminated with signal: SIGSEGV
Compiler returned: 139

PTRUE demo code:

@G = global <8 x i1> zeroinitializer

define void @test() {
  %C = fcmp une <8 x double> <double 4.200000e+01, double 4.200000e+01, double 4.200000e+01, double 4.200000e+01, double 4.200000e+01, double 4.200000e+01, double 4.200000e+01, double 4.200000e+01>, <double 0x7FEFFFFFFFFFFFFF, double 0x7FEFFFFFFFFFFFFF, double 0x7FEFFFFFFFFFFFFF, double 0x7FEFFFFFFFFFFFFF, double 0x7FEFFFFFFFFFFFFF, double 0x7FEFFFFFFFFFFFFF, double 0x7FEFFFFFFFFFFFFF, double 0x7FEFFFFFFFFFFFFF>
  store <8 x i1> %C, ptr @G, align 1
  ret void
}

PTRUE demo backtrace:

LLVM ERROR: Cannot select: 0x775b210: v8i1 = HexagonISD::PTRUE
In function: test
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-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -mtriple=hexagon <source>
1.	Running pass 'Function Pass Manager' on module '<source>'.
2.	Running pass 'Hexagon DAG->DAG Pattern Instruction Selection' on function '@test'
 #0 0x0000000003079ed8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3079ed8)
 #1 0x000000000307782c SignalHandler(int) Signals.cpp:0:0
 #2 0x00007fea21f91420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #3 0x00007fea21a5400b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #4 0x00007fea21a33859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #5 0x000000000069e37a llvm::RISCVISAInfo::updateImplication() (.cold) RISCVISAInfo.cpp:0:0
 #6 0x0000000002e5ead4 llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2e5ead4)
 #7 0x0000000002e641ad llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2e641ad)
 #8 0x0000000002e5c137 llvm::SelectionDAGISel::DoInstructionSelection() (/opt/compiler-explorer/clang-trunk/bin/llc+0x2e5c137)
 #9 0x0000000002e68a65 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-trunk/bin/llc+0x2e68a65)
#10 0x0000000002e6b4b9 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2e6b4b9)
#11 0x0000000002e6db86 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) SelectionDAGISel.cpp:0:0
#12 0x000000000124ba66 llvm::HexagonDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x124ba66)
#13 0x0000000002458b10 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#14 0x00000000029350e2 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x29350e2)
#15 0x0000000002935261 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2935261)
#16 0x0000000002936dd0 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2936dd0)
#17 0x00000000007640c0 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#18 0x00000000006a9122 main (/opt/compiler-explorer/clang-trunk/bin/llc+0x6a9122)
#19 0x00007fea21a35083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#20 0x000000000075c00e _start (/opt/compiler-explorer/clang-trunk/bin/llc+0x75c00e)
Program terminated with signal: SIGSEGV
Compiler returned: 139
@tinkerrc
Copy link
Contributor Author

CC @DataCorrupted @HazyFish

@llvmbot
Copy link
Collaborator

llvmbot commented Aug 25, 2023

@llvm/issue-subscribers-backend-hexagon

@androm3da
Copy link
Member

This seems very similar to #59009

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants