<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 - [InstCombine] Incorrect reassociation of loop invariant vector GEP"
href="https://bugs.llvm.org/show_bug.cgi?id=37005">37005</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[InstCombine] Incorrect reassociation of loop invariant vector GEP
</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>dneilson@azul.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>A recent change can produce incorrect IR when presented with vector GEPs.
Offending change:
commit 0c137c5660209ecc1bc487b7f88774405d5cd7cb
Author: Sebastian Pop <<a href="mailto:sebpop@gmail.com">sebpop@gmail.com</a>>
Date: Mon Mar 26 16:19:31 2018 +0000
[InstCombine] reassociate loop invariant GEP chains to enable LICM
------
Test case -- gep.ll:
declare void @blackhole(<2 x i8*>)
define void @foo(i8* %base, i8** %in) {
entry:
br label %loop
loop:
%e1 = getelementptr inbounds i8*, i8** %in, i64 undef
%e2 = getelementptr inbounds i8*, i8** %e1, i64 6
%bc1 = bitcast i8** %e2 to <2 x i8*>*
%e3 = getelementptr inbounds <2 x i8*>, <2 x i8*>* %bc1, i64 0, i64 0
%e4 = getelementptr inbounds i8*, i8** %e3, <2 x i64> <i64 0, i64 1>
%pi1 = ptrtoint <2 x i8**> %e4 to <2 x i64>
%lr1 = lshr <2 x i64> %pi1, <i64 21, i64 21>
%sl1 = shl nuw nsw <2 x i64> %lr1, <i64 7, i64 7>
%e5 = getelementptr inbounds i8, i8* %base, <2 x i64> %sl1
%e6 = getelementptr inbounds i8, <2 x i8*> %e5, i64 80
call void @blackhole(<2 x i8*> %e6)
br label %loop
}
------
Run with: opt -instcombine -S gep.ll
------
Produces:
declare void @blackhole(<2 x i8*>)
define void @foo(i8* %base, i8** %in) {
entry:
br label %loop
loop: ; preds = %loop, %entry
%e2 = getelementptr inbounds i8*, i8** %in, i64 undef
%e4 = getelementptr inbounds i8*, i8** %e2, <2 x i64> <i64 0, i64 1>
%pi1 = ptrtoint <2 x i8**> %e4 to <2 x i64>
%lr1 = lshr <2 x i64> %pi1, <i64 21, i64 21>
%sl1 = shl nuw nsw <2 x i64> %lr1, <i64 7, i64 7>
%e5 = getelementptr inbounds i8, i8* %base, i64 80
%e6 = getelementptr inbounds i8, <2 x i8*> %e5, <2 x i64> %sl1
call void @blackhole(<2 x i8*> %e6)
br label %loop
}
----
The change in question swaps the index operands of GEP %e5 and %e6. However,
the resulting %e5 is accidentally changed from a vector type to a scalar type.</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>