<html>
<head>
<base href="http://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 --- - Missing instcombine for mix of gep and bitcasts"
href="http://llvm.org/bugs/show_bug.cgi?id=22469">22469</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Missing instcombine for mix of gep and bitcasts
</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>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>listmail@philipreames.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>I ran across this test case the other day. It really seems like we should be
able to represent this as a single GEP given that we know the size of the
pointers involved.
; ModuleID = 'gep-test.ll'
target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux"
%Type2 = type { [8 x i8] }
%Type1 = type { [8 x i8] }
; Function Attrs: nounwind readnone
define %Type2 addrspace(1)* addrspace(1)* @test(%Type2 addrspace(1)* readnone
%ptr, i64 %idx) #0 {
%gep1 = getelementptr inbounds %Type2 addrspace(1)* %ptr, i64 8, i32 0, i64 0
%bc1 = bitcast i8 addrspace(1)* %gep1 to %Type1 addrspace(1)* addrspace(1)*
%gep2 = getelementptr inbounds %Type1 addrspace(1)* addrspace(1)* %bc1, i64
%idx
%final = bitcast %Type1 addrspace(1)* addrspace(1)* %gep2 to %Type2
addrspace(1)* addrspace(1)*
ret %Type2 addrspace(1)* addrspace(1)* %final
}
Note that we do emit a single "leaq" for this when run through LLC. It's only
at the IR level that we're uglier than we need to be.</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>