[llvm-bugs] [Bug 41288] New: opt crashes with "opt -loop-rotate -mem2reg -loop-versioning -jump-threading"

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 28 20:47:03 PDT 2019


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

            Bug ID: 41288
           Summary: opt crashes with "opt -loop-rotate -mem2reg
                    -loop-versioning -jump-threading"
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: cszide at 163.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 21695
  --> https://bugs.llvm.org/attachment.cgi?id=21695&action=edit
IR file of testcase

$clang -v
clang version 9.0.0 (trunk 355281)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/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.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.3.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64

opt -loop-rotate -mem2reg -loop-versioning -jump-threading  small.bc
Stack dump:
0.      Program arguments:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt -loop-rotate
-mem2reg -loop-versioning -jump-threading small.bc 
1.      Running pass 'Function Pass Manager' on module 'small.bc'.
2.      Running pass 'Jump Threading' on function '@c'
  #0 0x00005649379acd2a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x20d9d2a)
  #1 0x00005649379aad04 llvm::sys::RunSignalHandlers()
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x20d7d04)
  #2 0x00005649379aae42 SignalHandler(int)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x20d7e42)
  #3 0x00007fb82e403890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
  #4 0x00007fb82d10b30e _int_malloc
/build/glibc-OTsEL5/glibc-2.27/malloc/malloc.c:3557:0
  #5 0x00007fb82d10e0fc __libc_malloc
/build/glibc-OTsEL5/glibc-2.27/malloc/malloc.c:3058:0
  #6 0x00007fb82dab11a8 operator new(unsigned long)
(/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0x931a8)
  #7 0x0000564936d9f508 llvm::DenseMap<llvm::PoisoningVH<llvm::BasicBlock>,
llvm::SmallPtrSet<llvm::Value*, 4u>,
llvm::DenseMapInfo<llvm::PoisoningVH<llvm::BasicBlock> >,
llvm::detail::DenseMapPair<llvm::PoisoningVH<llvm::BasicBlock>,
llvm::SmallPtrSet<llvm::Value*, 4u> > >::grow(unsigned int)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x14cc508)
  #8 0x0000564936da25de (anonymous
namespace)::LazyValueInfoCache::insertResult(llvm::Value*, llvm::BasicBlock*,
llvm::ValueLatticeElement const&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x14cf5de)
  #9 0x0000564936da2e96 (anonymous namespace)::LazyValueInfoImpl::solve()
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x14cfe96)
 #10 0x0000564936da420e (anonymous
namespace)::LazyValueInfoImpl::getValueInBlock(llvm::Value*, llvm::BasicBlock*,
llvm::Instruction*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x14d120e)
 #11 0x0000564936da4292 llvm::LazyValueInfo::getConstant(llvm::Value*,
llvm::BasicBlock*, llvm::Instruction*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x14d1292)
 #12 0x0000564937789369
llvm::JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(llvm::Value*,
llvm::BasicBlock*, llvm::SmallVectorImpl<std::pair<llvm::Constant*,
llvm::BasicBlock*> >&, llvm::jumpthreading::ConstantPreference,
llvm::DenseSet<std::pair<llvm::Value*, llvm::BasicBlock*>,
llvm::DenseMapInfo<std::pair<llvm::Value*, llvm::BasicBlock*> > >&,
llvm::Instruction*) (.part.578)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1eb6369)
 #13 0x0000564937788aff
llvm::JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(llvm::Value*,
llvm::BasicBlock*, llvm::SmallVectorImpl<std::pair<llvm::Constant*,
llvm::BasicBlock*> >&, llvm::jumpthreading::ConstantPreference,
llvm::DenseSet<std::pair<llvm::Value*, llvm::BasicBlock*>,
llvm::DenseMapInfo<std::pair<llvm::Value*, llvm::BasicBlock*> > >&,
llvm::Instruction*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1eb5aff)
 #14 0x0000564937789570
llvm::JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(llvm::Value*,
llvm::BasicBlock*, llvm::SmallVectorImpl<std::pair<llvm::Constant*,
llvm::BasicBlock*> >&, llvm::jumpthreading::ConstantPreference,
llvm::DenseSet<std::pair<llvm::Value*, llvm::BasicBlock*>,
llvm::DenseMapInfo<std::pair<llvm::Value*, llvm::BasicBlock*> > >&,
llvm::Instruction*) (.part.578)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1eb6570)
 #15 0x0000564937788aff
llvm::JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(llvm::Value*,
llvm::BasicBlock*, llvm::SmallVectorImpl<std::pair<llvm::Constant*,
llvm::BasicBlock*> >&, llvm::jumpthreading::ConstantPreference,
llvm::DenseSet<std::pair<llvm::Value*, llvm::BasicBlock*>,
llvm::DenseMapInfo<std::pair<llvm::Value*, llvm::BasicBlock*> > >&,
llvm::Instruction*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1eb5aff)
 #16 0x0000564937789570
llvm::JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(llvm::Value*,
llvm::BasicBlock*, llvm::SmallVectorImpl<std::pair<llvm::Constant*,
llvm::BasicBlock*> >&, llvm::jumpthreading::ConstantPreference,
llvm::DenseSet<std::pair<llvm::Value*, llvm::BasicBlock*>,
llvm::DenseMapInfo<std::pair<llvm::Value*, llvm::BasicBlock*> > >&,
llvm::Instruction*) (.part.578)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1eb6570)
 #17 0x0000564937788aff
llvm::JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(llvm::Value*,
llvm::BasicBlock*, llvm::SmallVectorImpl<std::pair<llvm::Constant*,
llvm::BasicBlock*> >&, llvm::jumpthreading::ConstantPreference,
llvm::DenseSet<std::pair<llvm::Value*, llvm::BasicBlock*>,
llvm::DenseMapInfo<std::pair<llvm::Value*, llvm::BasicBlock*> > >&,
llvm::Instruction*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1eb5aff)
 #18 0x0000564937789570
llvm::JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(llvm::Value*,
llvm::BasicBlock*, llvm::SmallVectorImpl<std::pair<llvm::Constant*,
llvm::BasicBlock*> >&, llvm::jumpthreading::ConstantPreference,
llvm::DenseSet<std::pair<llvm::Value*, llvm::BasicBlock*>,
llvm::DenseMapInfo<std::pair<llvm::Value*, llvm::BasicBlock*> > >&,
llvm::Instruction*) (.part.578)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1eb6570)
 #19 0x0000564937788aff
llvm::JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(llvm::Value*,
llvm::BasicBlock*, llvm::SmallVectorImpl<std::pair<llvm::Constant*,
llvm::BasicBlock*> >&, llvm::jumpthreading::ConstantPreference,
llvm::DenseSet<std::pair<llvm::Value*, llvm::BasicBlock*>,
llvm::DenseMapInfo<std::pair<llvm::Value*, llvm::BasicBlock*> > >&,
llvm::Instruction*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1eb5aff)
 #20 0x0000564937789570
llvm::JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(llvm::Value*,
llvm::BasicBlock*, llvm::SmallVectorImpl<std::pair<llvm::Constant*,
llvm::BasicBlock*> >&, llvm::jumpthreading::ConstantPreference,
llvm::DenseSet<std::pair<llvm::Value*, llvm::BasicBlock*>,
llvm::DenseMapInfo<std::pair<llvm::Value*, llvm::BasicBlock*> > >&,
llvm::Instruction*) (.part.578)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1eb6570)
 #21 0x0000564937788aff
llvm::JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(llvm::Value*,
llvm::BasicBlock*, llvm::SmallVectorImpl<std::pair<llvm::Constant*,
llvm::BasicBlock*> >&, llvm::jumpthreading::ConstantPreference,
llvm::DenseSet<std::pair<llvm::Value*, llvm::BasicBlock*>,
llvm::DenseMapInfo<std::pair<llvm::Value*, llvm::BasicBlock*> > >&,
llvm::Instruction*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1eb5aff)
 #22 0x0000564937789570
llvm::JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(llvm::Value*,
llvm::BasicBlock*, llvm::SmallVectorImpl<std::pair<llvm::Constant*,
llvm::BasicBlock*> >&, llvm::jumpthreading::ConstantPreference,
llvm::DenseSet<std::pair<llvm::Value*, llvm::BasicBlock*>,
llvm::DenseMapInfo<std::pair<llvm::Value*, llvm::BasicBlock*> > >&,
llvm::Instruction*) (.part.578)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1eb6570)
 #23 0x0000564937788aff
llvm::JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(llvm::Value*,
llvm::BasicBlock*, llvm::SmallVectorImpl<std::pair<llvm::Constant*,
llvm::BasicBlock*> >&, llvm::jumpthreading::ConstantPreference,
llvm::DenseSet<std::pair<llvm::Value*, llvm::BasicBlock*>,
llvm::DenseMapInfo<std::pair<llvm::Value*, llvm::BasicBlock*> > >&,
llvm::Instruction*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1eb5aff)
 #24 0x0000564937789570
llvm::JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(llvm::Value*,
llvm::BasicBlock*, llvm::SmallVectorImpl<std::pair<llvm::Constant*,
llvm::BasicBlock*> >&, llvm::jumpthreading::ConstantPreference,
llvm::DenseSet<std::pair<llvm::Value*, llvm::BasicBlock*>,
llvm::DenseMapInfo<std::pair<llvm::Value*, llvm::BasicBlock*> > >&,
llvm::Instruction*) (.part.578)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1eb6570)
 #25 0x0000564937788aff
llvm::JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(llvm::Value*,
llvm::BasicBlock*, llvm::SmallVectorImpl<std::pair<llvm::Constant*,
llvm::BasicBlock*> >&, llvm::jumpthreading::ConstantPreference,
llvm::DenseSet<std::pair<llvm::Value*, llvm::BasicBlock*>,
llvm::DenseMapInfo<std::pair<llvm::Value*, llvm::BasicBlock*> > >&,
llvm::Instruction*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1eb5aff)
 #26 0x0000564937789570
llvm::JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(llvm::Value*,
llvm::BasicBlock*, llvm::SmallVectorImpl<std::pair<llvm::Constant*,
llvm::BasicBlock*> >&, llvm::jumpthreading::ConstantPreference,
llvm::DenseSet<std::pair<llvm::Value*, llvm::BasicBlock*>,
llvm::DenseMapInfo<std::pair<llvm::Value*, llvm::BasicBlock*> > >&,
llvm::Instruction*) (.part.578)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1eb6570)
 #27 0x0000564937788aff
llvm::JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(llvm::Value*,
llvm::BasicBlock*, llvm::SmallVectorImpl<std::pair<llvm::Constant*,
llvm::BasicBlock*> >&, llvm::jumpthreading::ConstantPreference,
llvm::DenseSet<std::pair<llvm::Value*, llvm::BasicBlock*>,
llvm::DenseMapInfo<std::pair<llvm::Value*, llvm::BasicBlock*> > >&,
llvm::Instruction*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1eb5aff)
 #28 0x0000564937789570
llvm::JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(llvm::Value*,
llvm::BasicBlock*, llvm::SmallVectorImpl<std::pair<llvm::Constant*,
llvm::BasicBlock*> >&, llvm::jumpthreading::ConstantPreference,
llvm::DenseSet<std::pair<llvm::Value*, llvm::BasicBlock*>,
llvm::DenseMapInfo<std::pair<llvm::Value*, llvm::BasicBlock*> > >&,
llvm::Instruction*) (.part.578)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1eb6570)
 #29 0x0000564937788aff
llvm::JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(llvm::Value*,
llvm::BasicBlock*, llvm::SmallVectorImpl<std::pair<llvm::Constant*,
llvm::BasicBlock*> >&, llvm::jumpthreading::ConstantPreference,
llvm::DenseSet<std::pair<llvm::Value*, llvm::BasicBlock*>,
llvm::DenseMapInfo<std::pair<llvm::Value*, llvm::BasicBlock*> > >&,
llvm::Instruction*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1eb5aff)
 #30 0x0000564937789570
llvm::JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(llvm::Value*,
llvm::BasicBlock*, llvm::SmallVectorImpl<std::pair<llvm::Constant*,
llvm::BasicBlock*> >&, llvm::jumpthreading::ConstantPreference,
llvm::DenseSet<std::pair<llvm::Value*, llvm::BasicBlock*>,
llvm::DenseMapInfo<std::pair<llvm::Value*, llvm::BasicBlock*> > >&,
llvm::Instruction*) (.part.578)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1eb6570)
 #31 0x0000564937788aff
llvm::JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(llvm::Value*,
llvm::BasicBlock*, llvm::SmallVectorImpl<std::pair<llvm::Constant*,
llvm::BasicBlock*> >&, llvm::jumpthreading::ConstantPreference,
llvm::DenseSet<std::pair<llvm::Value*, llvm::BasicBlock*>,
llvm::DenseMapInfo<std::pair<llvm::Value*, llvm::BasicBlock*> > >&,
llvm::Instruction*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1eb5aff)
 #32 0x0000564937789570
llvm::JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(llvm::Value*,
llvm::BasicBlock*, llvm::SmallVectorImpl<std::pair<llvm::Constant*,
llvm::BasicBlock*> >&, llvm::jumpthreading::ConstantPreference,
llvm::DenseSet<std::pair<llvm::Value*, llvm::BasicBlock*>,
llvm::DenseMapInfo<std::pair<llvm::Value*, llvm::BasicBlock*> > >&,
llvm::Instruction*) (.part.578)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1eb6570)
 #33 0x0000564937788aff 
.....
.....(too long)
Segmentation fault (core dumped)

This bug is strange. I found it using the LLVM truck version, but it cannot be
always reproduced for LLVM truck version. By using godbolt, I find it can be
always reproduced by llvm 6.0.0.
I don't know what caused the problem. Maybe it is a corner case, so I submit
it.

-- 
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/20190329/a160de87/attachment-0001.html>


More information about the llvm-bugs mailing list