<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 - [CloneModule] Cloned module retains some pointers to original module's objects"
href="https://bugs.llvm.org/show_bug.cgi?id=48425">48425</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[CloneModule] Cloned module retains some pointers to original module's objects
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>Transformation Utilities
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>itay.bookstein@nextsilicon.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>When BlockAddresses are used as initializers of GlobalVariables,
and the module is cloned, the BlockAddress constants used as
initializers in the cloned module contain pointers to the
BasicBlocks of the old module rather than the new one.
As far as I can tell, in ValueMapper.cpp, Mapper::flush() attempts
to RAUW the temporary basic block it created when attempting to map
the BlockAddress constant which it encountered as the initializer of
a GlobalVariable, and it passes the OldBB when failing to find a
target. To my limited understanding, it sounds risky/incorrect to
fall-back to the OldBB there. The BasicBlocks themselves are of
course properly mapped/cloned into the new module in CloneFunction.cpp,
in function llvm::CloneFunctionInto, but a comment there seems to
talk exactly about it not being legal to clone a function that has
an external BlockAddress referencing 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>