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

Clang trunk ICE (Assertion `Removed && "Register is not used by this instruction!) #28675

Closed
llvmbot opened this issue Jun 25, 2016 · 8 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla clang Clang issues not falling into any other category

Comments

@llvmbot
Copy link
Member

llvmbot commented Jun 25, 2016

Bugzilla Link 28301
Resolution FIXED
Resolved on Aug 08, 2016 20:48
Version trunk
OS Linux
Blocks #28974
Attachments Reproducer
Reporter LLVM Bugzilla Contributor
CC @dbabokin,@zmodem,@hfinkel,@MatzeB,@sanjoy

Extended Description

Reproduce:

clang++ -std=c++11 -O3 -o out.o -c crash.cpp

Output:
clang-3.9: /export/users/amitrokh/llvm/llvm-trunk/include/llvm/CodeGen/LiveVariables.h:226: bool llvm::LiveVariables::removeVirtualRegisterKilled(unsigned int, llvm::MachineInstr*): Assertion `Removed && "Register is not used by this instruction!"' failed.
#0 0x0000000001110535 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x1110535)
#1 0x000000000110e1e6 llvm::sys::RunSignalHandlers() (/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x110e1e6)
#2 0x000000000110e411 SignalHandler(int) (/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x110e411)
#3 0x00007f51216b6100 __restore_rt (/lib64/libpthread.so.0+0xf100)
#4 0x00007f51202ae5f7 __GI_raise (/lib64/libc.so.6+0x355f7)
#5 0x00007f51202afce8 __GI_abort (/lib64/libc.so.6+0x36ce8)
#6 0x00007f51202a7566 __assert_fail_base (/lib64/libc.so.6+0x2e566)
#7 0x00007f51202a7612 (/lib64/libc.so.6+0x2e612)
#8 0x0000000000b5c25f llvm::LiveVariables::removeVirtualRegisterKilled(unsigned int, llvm::MachineInstr*) (/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0xb5c25f)
#9 0x0000000000be659a (anonymous namespace)::TwoAddressInstructionPass::rescheduleMIBelowKill(llvm::MachineInstrBundleIterator<llvm::MachineInstr>&, llvm::MachineInstrBundleIterator<llvm::MachineInstr>&, unsigned int) (/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0xbe659a)
#10 0x0000000000be8a7c (anonymous namespace)::TwoAddressInstructionPass::tryInstructionTransform(llvm::MachineInstrBundleIterator<llvm::MachineInstr>&, llvm::MachineInstrBundleIterator<llvm::MachineInstr>&, unsigned int, unsigned int, unsigned int, bool) (/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0xbe8a7c)
#11 0x0000000000bec84f (anonymous namespace)::TwoAddressInstructionPass::runOnMachineFunction(llvm::MachineFunction&) (/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0xbec84f)
#12 0x0000000000af3294 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0xaf3294)
#13 0x0000000000d8d633 llvm::FPPassManager::runOnFunction(llvm::Function&) (/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0xd8d633)
#14 0x0000000000d8d9eb llvm::FPPassManager::runOnModule(llvm::Module&) (/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0xd8d9eb)
#15 0x0000000000d8dcff llvm::legacy::PassManagerImpl::run(llvm::Module&) (/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0xd8dcff)
#16 0x0000000001266b92 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, llvm::raw_pwrite_stream*) (/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x1266b92)
#17 0x000000000187b026 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x187b026)
#18 0x0000000001c95e3b clang::ParseAST(clang::Sema&, bool, bool) (/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x1c95e3b)
#19 0x000000000187b3db clang::CodeGenAction::ExecuteAction() (/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x187b3db)
#20 0x0000000001592766 clang::FrontendAction::Execute() (/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x1592766)
#21 0x000000000156c71e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x156c71e)
#22 0x00000000016271cc clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x16271cc)
#23 0x0000000000706718 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x706718)
#24 0x00000000006d9f7f main (/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x6d9f7f)
#25 0x00007f512029ab15 __libc_start_main (/lib64/libc.so.6+0x21b15)
#26 0x00000000007027b5 _start (/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x7027b5)
Stack dump:
0.      Program arguments: /export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name crash.cpp -mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -momit-leaf-frame-pointer -dwarf-column-info -debugger-tuning=gdb -coverage-file /export/users/amitrokh/forCreduce/untracked/clang_register_nu/out.o -resource-dir /export/users/amitrokh/llvm/bin-trunk/bin/../lib/clang/3.9.0 -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5 -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/x86_64-redhat-linux -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/backward -internal-isystem /usr/local/include -internal-isystem /export/users/amitrokh/llvm/bin-trunk/bin/../lib/clang/3.9.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /export/users/amitrokh/forCreduce/untracked/clang_register_nu -ferror-limit 19 -fmessage-length 237 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o out.o -x c++ crash.cpp
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'crash.cpp'.
4.      Running pass 'Two-Address instruction pass' on function '@_Z3fn1v'

> clang -v
clang version 3.9.0 (trunk 273570)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /export/users/amitrokh/llvm/bin-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/i686-redhat-linux/4.8.2
Found candidate GCC installation: /usr/lib/gcc/i686-redhat-linux/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
@llvmbot
Copy link
Member Author

llvmbot commented Jun 25, 2016

assigned to @MatzeB

@zmodem
Copy link
Collaborator

zmodem commented Aug 4, 2016

This seems to be a regression from 3.8.

+matze because the assert says "register" ;-)

@MatzeB
Copy link
Contributor

MatzeB commented Aug 4, 2016

I cannot reproduce. This could have to do with the contents of valarray or the target triple used.

Could you run

clang++ -std=c++11 -O3 crash.cpp -S -emit-llvm

and attach the resulting crash.ll to the bugreport?

@zmodem
Copy link
Collaborator

zmodem commented Aug 4, 2016

IR repro
Sure thing! This reproduces with llc for me:

$ bin/llc -o /dev/null /tmp/crash.ll
llc: ../include/llvm/CodeGen/LiveVariables.h:226: bool llvm::LiveVariables::removeVirtualRegisterKilled(unsigned int, llvm::MachineInstr&): Assertion `Removed && "Register is not used by this instruction!"' failed.
#0 0x0000000001896ac5 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (bin/llc+0x1896ac5)
#1 0x0000000001894a2e llvm::sys::RunSignalHandlers() (bin/llc+0x1894a2e)
#2 0x0000000001894b92 SignalHandler(int) (bin/llc+0x1894b92)
#3 0x00007f85f890e330 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007f85f7702c37 gsignal /build/eglibc-oGUzwX/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f85f7706028 abort /build/eglibc-oGUzwX/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f85f76fbbf6 __assert_fail_base /build/eglibc-oGUzwX/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f85f76fbca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x000000000130af3f llvm::LiveVariables::removeVirtualRegisterKilled(unsigned int, llvm::MachineInstr&) (bin/llc+0x130af3f)
#9 0x00000000013e1b76 (anonymous namespace)::TwoAddressInstructionPass::rescheduleMIBelowKill(llvm::MachineInstrBundleIterator<llvm::MachineInstr>&, llvm::MachineInstrBundleIterator<llvm::MachineInstr>&, unsigned int) (bin/llc+0x13e1b76)
#10 0x00000000013e3d5c (anonymous namespace)::TwoAddressInstructionPass::tryInstructionTransform(llvm::MachineInstrBundleIterator<llvm::MachineInstr>&, llvm::MachineInstrBundleIterator<llvm::MachineInstr>&, unsigned int, unsigned int, unsigned int, bool) (bin/llc+0x13e3d5c)
#11 0x00000000013e7f9e (anonymous namespace)::TwoAddressInstructionPass::runOnMachineFunction(llvm::MachineFunction&) (bin/llc+0x13e7f9e)
#12 0x0000000001286713 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (bin/llc+0x1286713)
#13 0x0000000001508313 llvm::FPPassManager::runOnFunction(llvm::Function&) (bin/llc+0x1508313)
#14 0x00000000015083ab llvm::FPPassManager::runOnModule(llvm::Module&) (bin/llc+0x15083ab)
#15 0x00000000015089af llvm::legacy::PassManagerImpl::run(llvm::Module&) (bin/llc+0x15089af)
#16 0x00000000006b61d4 compileModule(char**, llvm::LLVMContext&) (bin/llc+0x6b61d4)
#17 0x0000000000668bc0 main (bin/llc+0x668bc0)
#18 0x00007f85f76edf45 __libc_start_main /build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#19 0x00000000006ac1fd _start (bin/llc+0x6ac1fd)
Stack dump:
0.      Program arguments: bin/llc -o /dev/null /tmp/crash.ll 
1.      Running pass 'Function Pass Manager' on module '/tmp/crash.ll'.
2.      Running pass 'Two-Address instruction pass' on function '@_Z3fn1v'
Aborted (core dumped)

@MatzeB
Copy link
Contributor

MatzeB commented Aug 4, 2016

It still does not reproduce on ToT for me. I will try the 3.9 branch.

@MatzeB
Copy link
Contributor

MatzeB commented Aug 4, 2016

Ups, the crash.ll I used was the one I previously created myself, my browser safed the actual reproducer from this ticket as crash-2.ll and that one reproduces even on ToT.

@MatzeB
Copy link
Contributor

MatzeB commented Aug 9, 2016

Fixed in r278086.

I am pretty sure the problem existed since 2013. Probably triggered by an unrelated change if this specific example only crashed in 3.9.

@zmodem
Copy link
Collaborator

zmodem commented Nov 26, 2021

mentioned in issue #28974

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang Clang issues not falling into any other category
Projects
None yet
Development

No branches or pull requests

3 participants