<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - LibCallsShrinkWrap falsely claims to preserve CFG"
   href="https://llvm.org/bugs/show_bug.cgi?id=30929">30929</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LibCallsShrinkWrap falsely claims to preserve CFG
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </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>opt
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jesper.antonsson@ericsson.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>We get multiple different fails in our randomized testing using the
LibCallsShrinkWrap pass. The problem is that this pass claims to preserve the
CFG, but it actually doesn't, which (at least) gives problems with the domtree.

The problem can be replicated with this tiny program:

define void @TEST__MAIN() {
  %_tmp31 = call float @acosf(float 2.000000e+00)
  ret void
}
declare float @acosf(float)

It fails in gvn using the following opt call:

 opt -instcombine -libcalls-shrinkwrap -gvn ./shrink.ll

Failing assert:

opt: ../include/llvm/Support/GenericDomTree.h:591: void
llvm::DominatorTreeBase<llvm::BasicBlock>::changeImmediateDominator(DomTreeNodeBase<NodeT>
*, DomTreeNodeBase<NodeT> *) [N = llvm::BasicBlock]: Assertion `N && NewIDom &&
"Cannot change null node pointers!"' failed.

One can also insert a -verify-dom-info after the -libcalls-shrinkwrap option,
and that will report the problem as well:
DominatorTree for function: TEST__MAIN is not up to date!</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>