<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 --- - CloneModule does not remap personality of a function correctly" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23992&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=zvns5T41FIQf4WocwfbjUW8Uc_6kmce9ux76CSou6_0&s=j-z_nTcXQqEWeGYqzY4YUGvK-Y-K-_a8wiedeNnkGrM&e=">23992</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>CloneModule does not remap personality of a function correctly
</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>Transformation Utilities
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>tom.aernoudt@synopsys.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=14537" name="attach_14537" title="testcase">attachment 14537</a> <a href="attachment.cgi?id=14537&action=edit" title="testcase">[details]</a></span>
testcase
It looks like the CloneModule utility function does not remap the personality
operand of a function correctly.
After cloning the module following assert is triggered when printing the module
with module->print(llvm::outs(), 0, true):
testCloneModule:
/localdev/aernoudt/programs/llvm/git/llvm/lib/IR/AsmWriter.cpp:203: void
predictValueUseListOrder(const llvm::Value*, const llvm::Function*,
{anonymous}::OrderMap&, llvm::UseListOrderStack&): Assertion `IDPair.first &&
"Unmapped value"' failed.
The unmapped value is the personality operand of the function testFunction.
The issue can be reproduced with the attached testcase (on a debug build of
llvm):
<span class="quote">> clang++ -c -O3 -std=c++11 -emit-llvm -o test.bc test.cc
> g++ `llvm-config --cxxflags` -o testCloneModule testCloneModule.cc `llvm-config --ldflags` `llvm-config --system-libs --libs core ipo bitreader irreader`
> ./cloneModule</span >
--> Fail: assert triggered
Disabling exceptions, which removes the personality operand of the function
testFunction makes the test pass:
<span class="quote">> clang++ -c -O3 -std=c++11 -emit-llvm -DNO_EXCEPTIONS -fno-exceptions -o test.bc test.cc
> g++ `llvm-config --cxxflags` -o testCloneModule testCloneModule.cc `llvm-config --ldflags` `llvm-config --system-libs --libs core ipo bitreader irreader`
> ./cloneModule</span >
--> Ok</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>