<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 - LoopInvariantCodeMotion do not preserve PostDominatorTree info"
   href="https://bugs.llvm.org/show_bug.cgi?id=37369">37369</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LoopInvariantCodeMotion do not preserve PostDominatorTree info
          </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>normal
          </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>karl-johan.karlsson@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=20272" name="attach_20272" title="opt -indvars -divergence -licm -adce -S -mtriple=i686-- -o /dev/null foo.ll">attachment 20272</a> <a href="attachment.cgi?id=20272&action=edit" title="opt -indvars -divergence -licm -adce -S -mtriple=i686-- -o /dev/null foo.ll">[details]</a></span>
opt -indvars -divergence -licm -adce -S -mtriple=i686-- -o /dev/null foo.ll

The pass LoopInvariantCodeMotion state that it preserve CFG
(PA.preserveSet<CFGAnalyses>() and AU.setPreservesCFG()) which mean that
PostDominatorTree should be preserved. Unfortunately that seems not to be the
case.

The testcase below first build PostDominatorTree information then LICM destroy
the information and when ADCE try to use the information it is no longer there.

$ ./opt -indvars -divergence -licm -adce -S -mtriple=i686-- -o /dev/null foo.ll
Stack dump:
0.      Program arguments: ./opt -indvars -divergence -licm -adce -S
-mtriple=i686-- -o /dev/null foo.ll 
1.      Running pass 'Function Pass Manager' on module 'foo.ll'.
2.      Running pass 'Aggressive Dead Code Elimination' on function '@f1'
#0 0x0000000001b3ee54 PrintStackTraceSignalHandler(void*) (./opt+0x1b3ee54)
#1 0x0000000001b3f556 SignalHandler(int) (./opt+0x1b3f556)
#2 0x00007f225ee20330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#3 0x0000000001370830 llvm::IDFCalculator<llvm::Inverse<llvm::BasicBlock*>,
true>::calculate(llvm::SmallVectorImpl<llvm::BasicBlock*>&) (./opt+0x1370830)
#4 0x000000000193e268 (anonymous
namespace)::AggressiveDeadCodeElimination::performDeadCodeElimination()
(./opt+0x193e268)
#5 0x000000000193fa95 (anonymous
namespace)::ADCELegacyPass::runOnFunction(llvm::Function&) (./opt+0x193fa95)
#6 0x00000000016c3eb8 llvm::FPPassManager::runOnFunction(llvm::Function&)
(./opt+0x16c3eb8)
#7 0x00000000016c4098 llvm::FPPassManager::runOnModule(llvm::Module&)
(./opt+0x16c4098)
#8 0x00000000016c449c llvm::legacy::PassManagerImpl::run(llvm::Module&)
(./opt+0x16c449c)
#9 0x0000000000731867 main (./opt+0x731867)
#10 0x00007f225d9faf45 __libc_start_main
/build/eglibc-ripdx6/eglibc-2.19/csu/libc-start.c:321:0
#11 0x000000000071fc37 _start (./opt+0x71fc37)
Segmentation fault (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>