[llvm-bugs] [Bug 43322] New: loop-versioning crashes: Assertion `idx < size()' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Sep 15 23:09:41 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=43322

            Bug ID: 43322
           Summary: loop-versioning crashes: Assertion `idx < size()'
                    failed.
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Transformation Utilities
          Assignee: unassignedbugs at nondot.org
          Reporter: cszide at 163.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 22501
  --> https://bugs.llvm.org/attachment.cgi?id=22501&action=edit
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)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190916/50fcfb12/attachment.html>


More information about the llvm-bugs mailing list