Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

loop-versioning crashes: Assertion `idx < size()' failed. #42293

Open Quuxplusone opened 4 years ago

Quuxplusone commented 4 years ago
Bugzilla Link PR43322
Status NEW
Importance P enhancement
Reported by Zhide Zhou (cszide@163.com)
Reported on 2019-09-15 23:09:41 -0700
Last modified on 2019-09-15 23:10:57 -0700
Version trunk
Hardware PC Linux
CC llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments salsa20.c (2117 bytes, text/x-csrc)
salsa20.bc (22328 bytes, application/octet-stream)
bugpoint-reduced-simplified.bc (2020 bytes, application/octet-stream)
Blocks
Blocked by
See also
Created attachment 22501
salsa20.c

In this bug, opt crashes for the program salsa20.c in testsuit with loop-
versioning pass.

$clang -v
clang version 10.0.0 (trunk 371952)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.4.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64

$clang -O3 -c -emit-llvm -femit-all-decls -mllvm -disable-llvm-optzns salsa20.c

$opt -licm -loop-rotate -loop-unroll -mem2reg -loop-versioning salsa20.bc

opt: /home/jack-
zhou/Documents/llvm/llvm_truck/llvm2/include/llvm/ADT/SmallVector.h:153: const
T& llvm::SmallVectorTemplateCommon<T, <template-parameter-1-2>
>::operator[](llvm::SmallVectorTemplateCommon<T, <template-parameter-1-2>
>::size_type) const [with T = llvm::RuntimePointerChecking::PointerInfo;
<template-parameter-1-2> = void; llvm::SmallVectorTemplateCommon<T, <template-
parameter-1-2> >::const_reference = const
llvm::RuntimePointerChecking::PointerInfo&; llvm::SmallVectorTemplateCommon<T,
<template-parameter-1-2> >::size_type = long unsigned int]: Assertion `idx <
size()' failed.
Stack dump:
0.  Program arguments: /home/jack-
zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt -licm -loop-rotate -loop-
unroll -mem2reg -loop-versioning salsa20.bc
1.  Running pass 'Function Pass Manager' on module 'salsa20.bc'.
2.  Running pass 'Loop Versioning' on function '@salsa20'
 #0 0x000056373999e27a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x277727a)
 #1 0x000056373999bf54 llvm::sys::RunSignalHandlers() (/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x2774f54)
 #2 0x000056373999c092 SignalHandler(int) (/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x2775092)
 #3 0x00007fc518ad2890 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #4 0x00007fc517784e97 raise /build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #5 0x00007fc517786801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
 #6 0x00007fc51777639a __assert_fail_base /build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
 #7 0x00007fc517776412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
 #8 0x0000563739a5f68f llvm::LoopVersioning::prepareNoAliasMetadata() (/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x283868f)
 #9 0x0000563739a601ec llvm::LoopVersioning::annotateLoopWithNoAlias() (/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x28391ec)
#10 0x0000563739a6256e (anonymous
namespace)::LoopVersioningPass::runOnFunction(llvm::Function&) (/home/jack-
zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x283b56e)
#11 0x00005637392ddde9 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x20b6de9)
#12 0x00005637392ddee1 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x20b6ee1)
#13 0x00005637392dd041 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x20b6041)
#14 0x0000563737ab674f main (/home/jack-
zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x88f74f)
#15 0x00007fc517767b97 __libc_start_main /build/glibc-OTsEL5/glibc-
2.27/csu/../csu/libc-start.c:344:0
#16 0x0000563737b2e54a _start (/home/jack-
zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x90754a)
Aborted (core dumped)

By using bugpoint, the optimization sequence can be further reduced.

$opt bugpoint-reduced-simplified.bc -loop-versioning

opt: /home/jack-
zhou/Documents/llvm/llvm_truck/llvm2/include/llvm/ADT/SmallVector.h:153: const
T& llvm::SmallVectorTemplateCommon<T, <template-parameter-1-2>
>::operator[](llvm::SmallVectorTemplateCommon<T, <template-parameter-1-2>
>::size_type) const [with T = llvm::RuntimePointerChecking::PointerInfo;
<template-parameter-1-2> = void; llvm::SmallVectorTemplateCommon<T, <template-
parameter-1-2> >::const_reference = const
llvm::RuntimePointerChecking::PointerInfo&; llvm::SmallVectorTemplateCommon<T,
<template-parameter-1-2> >::size_type = long unsigned int]: Assertion `idx <
size()' failed.
Stack dump:
0.  Program arguments: /home/jack-
zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt bugpoint-reduced-
simplified.bc -loop-versioning
1.  Running pass 'Function Pass Manager' on module 'bugpoint-reduced-
simplified.bc'.
2.  Running pass 'Loop Versioning' on function '@salsa20'
 #0 0x0000562055ca427a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x277727a)
 #1 0x0000562055ca1f54 llvm::sys::RunSignalHandlers() (/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x2774f54)
 #2 0x0000562055ca2092 SignalHandler(int) (/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x2775092)
 #3 0x00007fc495a0a890 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #4 0x00007fc4946bce97 raise /build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #5 0x00007fc4946be801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
 #6 0x00007fc4946ae39a __assert_fail_base /build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
 #7 0x00007fc4946ae412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
 #8 0x0000562055d6568f llvm::LoopVersioning::prepareNoAliasMetadata() (/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x283868f)
 #9 0x0000562055d661ec llvm::LoopVersioning::annotateLoopWithNoAlias() (/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x28391ec)
#10 0x0000562055d6856e (anonymous
namespace)::LoopVersioningPass::runOnFunction(llvm::Function&) (/home/jack-
zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x283b56e)
#11 0x00005620555e3de9 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x20b6de9)
#12 0x00005620555e3ee1 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x20b6ee1)
#13 0x00005620555e3041 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x20b6041)
#14 0x0000562053dbc74f main (/home/jack-
zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x88f74f)
#15 0x00007fc49469fb97 __libc_start_main /build/glibc-OTsEL5/glibc-
2.27/csu/../csu/libc-start.c:344:0
#16 0x0000562053e3454a _start (/home/jack-
zhou/Documents/llvm/llvm_truck/llvm2/build9/bin/opt+0x90754a)
Aborted (core dumped)
Quuxplusone commented 4 years ago

Attached salsa20.c (2117 bytes, text/x-csrc): salsa20.c

Quuxplusone commented 4 years ago

Attached salsa20.bc (22328 bytes, application/octet-stream): salsa20.bc

Quuxplusone commented 4 years ago

Attached bugpoint-reduced-simplified.bc (2020 bytes, application/octet-stream): bugpoint-reduced-simplified.bc