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

Assertion failed in function processTiedPairs #39643

Open
llvmbot opened this issue Jan 11, 2019 · 2 comments
Open

Assertion failed in function processTiedPairs #39643

llvmbot opened this issue Jan 11, 2019 · 2 comments
Labels
bugzilla Issues migrated from bugzilla confirmed Verified by a second party llvm:crash llvm:optimizations

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Jan 11, 2019

Bugzilla Link 40296
Version 7.0
OS FreeBSD
Reporter LLVM Bugzilla Contributor

Extended Description

Hello, I'm getting an assertion failure building this project [1] on FreeBSD 13 using clang 7.0.1:

$ cc -Daws_checksums_EXPORTS -I/usr/ports/devel/aws-checksums/work/aws-checksums-0.1.2/include -I/usr/ports/devel/aws-checksums/work/aws-checksums-0.1.2/tests -O2 -pipe -fstack-protector -fno-strict-aliasing -O2 -pipe -fstack-protector -fno-strict-aliasing -fPIC -fPIC -std=gnu99 -MD -MT CMakeFiles/aws-checksums.dir/source/intel/crc32c_sse42_asm.c.o -MF CMakeFiles/aws-checksums.dir/source/intel/crc32c_sse42_asm.c.o.d -o CMakeFiles/aws-checksums.dir/source/intel/crc32c_sse42_asm.c.o -c /usr/ports/devel/aws-checksums/work/aws-checksums-0.1.2/source/intel/crc32c_sse42_asm.c -O3
Assertion failed: (i == DstIdx || !MI->getOperand(i).isReg() || MI->getOperand(i).getReg() != RegA), function processTiedPairs, file /usr/src/contrib/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp, line 1544.
cc: error: unable to execute command: Abort trap (core dumped)
cc: error: clang frontend command failed due to signal (use -v to see invocation)
FreeBSD clang version 7.0.1 (tags/RELEASE_701/final 349250) (based on LLVM 7.0.1)

This is the file: https://github.com/awslabs/aws-checksums/blob/master/source/intel/crc32c_sse42_asm.c

It seems LLVM is triggering this assert because the inline assembly is not in SSA form. Inline assembly is not supposed to be emitted as it is?

For convenience, here is the assertion code: https://github.com/llvm-project/llvm/blob/master/lib/CodeGen/TwoAddressInstructionPass.cpp?#L1545

Thanks in advance.

Danilo.

[1] - https://github.com/awslabs/aws-checksums

@fhahn
Copy link
Contributor

fhahn commented Apr 21, 2022

Still an issue, see #54957

@Endilll
Copy link
Contributor

Endilll commented Aug 5, 2023

Still crashing as of post-17 trunk: https://godbolt.org/z/95nKTbGvd
Reduced by C-Reduce:

int aws_checksums_crc32c_hw_input_crc;
void aws_checksums_crc32c_hw_input() {
  asm("" : "+c"(aws_checksums_crc32c_hw_input_crc) : "c"(0));
}

Unreduced test case (composed manually based on creation date): https://godbolt.org/z/66Y1eovK6
Crash log:

clang++: /root/llvm-project/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp:1490:
void {anonymous}::TwoAddressInstructionPass::processTiedPairs(llvm::MachineInstr*, {anonymous}::TwoAddressInstructionPass::TiedPairList&, unsigned int&):
Assertion `i == DstIdx || !MI->getOperand(i).isReg() || MI->getOperand(i).getReg() != RegA' failed.

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: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -x c <source>
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module '<source>'.
4.	Running pass 'Two-Address instruction pass' on function '@aws_checksums_crc32c_hw_input'
 #0 0x0000000003672a98 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3672a98)
 #1 0x000000000367091c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x367091c)
 #2 0x00000000035be178 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007f9f90954420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007f9f9041700b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #5 0x00007f9f903f6859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #6 0x00007f9f903f6729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
 #7 0x00007f9f90407fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #8 0x0000000002d1bf1f (anonymous namespace)::TwoAddressInstructionPass::processTiedPairs(llvm::MachineInstr*, llvm::SmallVector<std::pair<unsigned int, unsigned int>, 4u>&, unsigned int&) TwoAddressInstructionPass.cpp:0:0
 #9 0x0000000002d1dc56 (anonymous namespace)::TwoAddressInstructionPass::runOnMachineFunction(llvm::MachineFunction&) TwoAddressInstructionPass.cpp:0:0
#10 0x0000000002a6fb99 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#11 0x0000000003013c09 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3013c09)
#12 0x0000000003013e41 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3013e41)
#13 0x0000000003014662 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3014662)
#14 0x00000000038e2640 (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) BackendUtil.cpp:0:0
#15 0x00000000038e2f69 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x38e2f69)
#16 0x00000000048c51ef clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x48c51ef)
#17 0x0000000005d7dd79 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5d7dd79)
#18 0x00000000048c39d8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x48c39d8)
#19 0x000000000412ba49 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x412ba49)
#20 0x00000000040afdde clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x40afdde)
#21 0x000000000420bcb6 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x420bcb6)
#22 0x0000000000bcb2e2 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbcb2e2)
#23 0x0000000000bc3aca ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#24 0x0000000003f0fc89 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#25 0x00000000035be624 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x35be624)
#26 0x0000000003f1027f clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#27 0x0000000003ed81e5 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3ed81e5)
#28 0x0000000003ed8c4d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3ed8c4d)
#29 0x0000000003ee0775 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3ee0775)
#30 0x0000000000bc9597 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbc9597)
#31 0x0000000000ac3661 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xac3661)
#32 0x00007f9f903f8083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#33 0x0000000000bc35ae _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbc35ae)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)

@Endilll Endilll added the confirmed Verified by a second party label Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla confirmed Verified by a second party llvm:crash llvm:optimizations
Projects
None yet
Development

No branches or pull requests

4 participants