<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - opt crashes with "opt -loop-rotate -mem2reg -loop-versioning -jump-threading""
   href="https://bugs.llvm.org/show_bug.cgi?id=41288">41288</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>opt crashes with "opt -loop-rotate -mem2reg -loop-versioning -jump-threading"
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Scalar Optimizations
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>cszide@163.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21695" name="attach_21695" title="IR file of testcase">attachment 21695</a> <a href="attachment.cgi?id=21695&action=edit" title="IR file of testcase">[details]</a></span>
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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>