<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 --- - Alias to Linkonce global / canonical representation for Aliases"
href="https://llvm.org/bugs/show_bug.cgi?id=27866">27866</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Alias to Linkonce global / canonical representation for Aliases
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mehdi.amini@apple.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>I spent some time with Duncan today trying to understand aliases and we came to
the conclusion that:
@a = global i32 0
@b = alias @a
should be equivalent to:
@0 = private i32 0
@a = alias @0
@b = alias @0
We may even consider this as a canonical representation of aliases and have
global-opt actually take care of doing this transformation.
However some behavior is unexpected, right now running llvm-link with the
following IR:
@A = linkonce_odr global i8 1
@B = alias i8, i8* @A
will generate the same IR. It means that linking @B actually introduce the
symbol @A as if the alias is an actual use of the other name. Running
globalopt/global-dce does not change the IR.
However if we "canonicalize" to:
@0 = private global i8 1
@A = linkonce_odr alias i8, i8* @0
@B = alias i8, i8* @0
Then llvm-link generates:
@0 = private global i8 1
@B = alias i8, i8* @0
In this case the symbol @A will *not* be pulled in.
Also, if instead of running llvm-link we run globaldce, we end up with the same
result (@A is dropped).
Finally globalopt is able to turn this IR into:
@B = constant i8 1</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>