<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 -licm crashes with Assertion `MSSA->dominates(NewDef, FirstDef) && "Should have dominated the new access"' failed."
   href="https://bugs.llvm.org/show_bug.cgi?id=43438">43438</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>opt -licm crashes with Assertion `MSSA->dominates(NewDef, FirstDef) && "Should have dominated the new access"' failed.
          </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>Loop Optimizer
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>mikael.holmen@ericsson.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=22567" name="attach_22567" title="reproducer">attachment 22567</a> <a href="attachment.cgi?id=22567&action=edit" title="reproducer">[details]</a></span>
reproducer

This crashes on current trunk: r372813

Reproduce with:
 opt -S -o - licm2.ll -licm

Result:

opt: ../lib/Analysis/MemorySSAUpdater.cpp:465: void
llvm::MemorySSAUpdater::fixupDefs(const SmallVectorImpl<llvm::WeakVH> &):
Assertion `MSSA->dominates(NewDef, FirstDef) && "Should have dominated the new
access"' failed.
Stack dump:
0.  Program arguments: /data/repo/master/llvm/build-all-builtins/bin/opt -S -o
- licm2.ll -licm 
1.  Running pass 'Function Pass Manager' on module 'licm2.ll'.
2.  Running pass 'Loop Pass Manager' on function '@main'
3.  Running pass 'Loop Invariant Code Motion' on basic block '%for.cond'
 #0 0x000000000243ce24 PrintStackTraceSignalHandler(void*)
(/data/repo/master/llvm/build-all-builtins/bin/opt+0x243ce24)
 #1 0x000000000243ab4e llvm::sys::RunSignalHandlers()
(/data/repo/master/llvm/build-all-builtins/bin/opt+0x243ab4e)
 #2 0x000000000243d228 SignalHandler(int)
(/data/repo/master/llvm/build-all-builtins/bin/opt+0x243d228)
 #3 0x00007fd26405a890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #4 0x00007fd262b03e97 raise
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #5 0x00007fd262b05801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
 #6 0x00007fd262af539a __assert_fail_base
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
 #7 0x00007fd262af5412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
 #8 0x00000000017c4e3c
llvm::MemorySSAUpdater::fixupDefs(llvm::SmallVectorImpl<llvm::WeakVH> const&)
(/data/repo/master/llvm/build-all-builtins/bin/opt+0x17c4e3c)
 #9 0x00000000017c39f8 llvm::MemorySSAUpdater::insertDef(llvm::MemoryDef*,
bool) (/data/repo/master/llvm/build-all-builtins/bin/opt+0x17c39f8)
#10 0x000000000220da23 (anonymous
namespace)::LoopPromoter::doExtraRewritesBeforeFinalDeletion()
(/data/repo/master/llvm/build-all-builtins/bin/opt+0x220da23)
#11 0x00000000024f9971
llvm::LoadAndStorePromoter::run(llvm::SmallVectorImpl<llvm::Instruction*>
const&) (/data/repo/master/llvm/build-all-builtins/bin/opt+0x24f9971)
#12 0x000000000220960a
llvm::promoteLoopAccessesToScalars(llvm::SmallSetVector<llvm::Value*, 8u>
const&, llvm::SmallVectorImpl<llvm::BasicBlock*>&,
llvm::SmallVectorImpl<llvm::Instruction*>&,
llvm::SmallVectorImpl<llvm::MemoryAccess*>&, llvm::PredIteratorCache&,
llvm::LoopInfo*, llvm::DominatorTree*, llvm::TargetLibraryInfo const*,
llvm::Loop*, llvm::AliasSetTracker*, llvm::MemorySSAUpdater*,
llvm::ICFLoopSafetyInfo*, llvm::OptimizationRemarkEmitter*)
(/data/repo/master/llvm/build-all-builtins/bin/opt+0x220960a)
#13 0x00000000021ff4bb (anonymous
namespace)::LoopInvariantCodeMotion::runOnLoop(llvm::Loop*, llvm::AAResults*,
llvm::LoopInfo*, llvm::DominatorTree*, llvm::TargetLibraryInfo*,
llvm::TargetTransformInfo*, llvm::ScalarEvolution*, llvm::MemorySSA*,
llvm::OptimizationRemarkEmitter*, bool)
(/data/repo/master/llvm/build-all-builtins/bin/opt+0x21ff4bb)
#14 0x000000000220a089 (anonymous
namespace)::LegacyLICMPass::runOnLoop(llvm::Loop*, llvm::LPPassManager&)
(/data/repo/master/llvm/build-all-builtins/bin/opt+0x220a089)
#15 0x000000000178e5e2 llvm::LPPassManager::runOnFunction(llvm::Function&)
(/data/repo/master/llvm/build-all-builtins/bin/opt+0x178e5e2)
#16 0x0000000001da9303 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/data/repo/master/llvm/build-all-builtins/bin/opt+0x1da9303)
#17 0x0000000001da9613 llvm::FPPassManager::runOnModule(llvm::Module&)
(/data/repo/master/llvm/build-all-builtins/bin/opt+0x1da9613)
#18 0x0000000001da9c7d llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/data/repo/master/llvm/build-all-builtins/bin/opt+0x1da9c7d)
#19 0x00000000007dac2d main
(/data/repo/master/llvm/build-all-builtins/bin/opt+0x7dac2d)
#20 0x00007fd262ae6b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#21 0x00000000007bfd6a _start
(/data/repo/master/llvm/build-all-builtins/bin/opt+0x7bfd6a)
Abort (core dumped)</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>