<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 - SROA miscomputes struct element offsets"
href="https://bugs.llvm.org/show_bug.cgi?id=34940">34940</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>SROA miscomputes struct element offsets
</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>vtjnash@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=19270" name="attach_19270" title="mixed-size-sroa-confusion">attachment 19270</a> <a href="attachment.cgi?id=19270&action=edit" title="mixed-size-sroa-confusion">[details]</a></span>
mixed-size-sroa-confusion
As can be seen from running the SROA pass on the attached IR, SROA seems to be
confused about the size of simple mixed-type struct aggregates. It seems to
think all of the struct elements must be the same? This can be seen from its
attempt to store an `i32 undef` to the i8 field, the missing store of the
second `i8 0`, and the effect of increasing the memcpy size on those.
$ ./opt -o - mixed-size-sroa.ll -S -sroa
define void @mixed_size_sroa_confusion({ { i32, i8 }, { i8, i8 } }*) {
top:
%1 = bitcast { { i32, i8 }, { i8, i8 } }* %0 to i8*
%.sroa.0.0..sroa_idx = getelementptr inbounds { { i32, i8 }, { i8, i8 } }, {
{ i32, i8 }, { i8, i8 } }* %0, i64 0, i32 0, i32 0
store i32 undef, i32* %.sroa.0.0..sroa_idx, align 1
%.sroa.1.0..sroa_idx = getelementptr inbounds { { i32, i8 }, { i8, i8 } }, {
{ i32, i8 }, { i8, i8 } }* %0, i64 0, i32 0, i32 1
store i8 0, i8* %.sroa.1.0..sroa_idx, align 1
%.sroa.2.0..sroa_idx = getelementptr inbounds i8, i8* %1, i64 5
%.sroa.2.0..sroa_cast = bitcast i8* %.sroa.2.0..sroa_idx to i16*
%.sroa.2.0.extract.trunc = trunc i32 undef to i16
store i16 %.sroa.2.0.extract.trunc, i16* %.sroa.2.0..sroa_cast, align 1
ret void
}</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>