<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 --- - Reassociate removes call but preserves CG, asserts"
href="https://llvm.org/bugs/show_bug.cgi?id=30784">30784</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Reassociate removes call but preserves CG, asserts
</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>Created <span class=""><a href="attachment.cgi?id=17486" name="attach_17486" title="Reduced ll file exposing the bug">attachment 17486</a> <a href="attachment.cgi?id=17486&action=edit" title="Reduced ll file exposing the bug">[details]</a></span>
Reduced ll file exposing the bug
The reassociate pass may remove a call and then falsely claim to preserve the
CG. This later leads to this assert at dead function removal:
opt: ../include/llvm/Analysis/CallGraph.h:184:
llvm::CallGraphNode::~CallGraphNode(): Assertion `NumReferences == 0 && "Node
deleted while references remain"' failed.
One simple fix is to set the variable MadeChange to true in
RecursivelyEraseDeadInsts() if operating on a CallInst. (However, the
preservation code acting on MadeChange has a comment indicating that even when
set to true it should preserve the CG, but currently it does not.)
The attached ll-file can be used to provoke the bug using:
opt -inline -functionattrs -reassociate reassoc-reduced.ll
The attached file originates from our randomised csmith test suite, but was
reduced to a minimum before inclusion here. I was unable to reduce the command
line to a single pass one.</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>