<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 - Invalid transform: gep p, (q-p) -> q"
href="https://bugs.llvm.org/show_bug.cgi?id=45444">45444</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Invalid transform: gep p, (q-p) -> q
</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>Keywords</th>
<td>miscompilation
</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>nunoplopes@sapo.pt
</td>
</tr>
<tr>
<th>CC</th>
<td>efriedma@quicinc.com, juneyoung.lee@sf.snu.ac.kr, lebedev.ri@gmail.com, llvm-bugs@lists.llvm.org, regehr@cs.utah.edu, spatel+llvm@rotateright.com
</td>
</tr></table>
<p>
<div>
<pre>Unit test: Transforms/InstCombine/getelementptr.ll
Summary: just because 2 pointers have the same integer value it doesn't mean
they are the same pointer. While %gep is in bounds, %c2 may refer to another
object with an OOB pointer.
define * @test45(* %c1, * %c2) {
%0:
%ptrtoint1 = ptrtoint * %c1 to i64
%ptrtoint2 = ptrtoint * %c2 to i64
%sub = sub i64 %ptrtoint2, %ptrtoint1
%shr = sdiv i64 %sub, 7
%gep = gep inbounds * %c1, 7 x i64 %shr
ret * %gep
}
=>
define * @test45(* %c1, * %c2) {
%0:
%gep = bitcast * %c2 to *
ret * %gep
}
Transformation doesn't verify!
ERROR: Value mismatch
Example:
* %c1 = pointer(non-local, block_id=1, offset=7790792235569643584)
* %c2 = pointer(non-local, block_id=0, offset=8251192938491543615)
Source:
i64 %ptrtoint1 = #x72907442c8000040 (8255225947142225984)
i64 %ptrtoint2 = #x72822042c800003f (8251192938491543615)
i64 %sub = #xfff1abffffffffff (18442711065058869247, -4033008650682369)
i64 %shr = #xfffdf40000000000 (18446167929616596992, -576144092954624)
* %gep = pointer(non-local, block_id=1, offset=7786759226918961216)
Target:
* %gep = pointer(non-local, block_id=0, offset=8251192938491543615)
Source value: pointer(non-local, block_id=1, offset=7786759226918961216)
Target value: pointer(non-local, block_id=0, offset=8251192938491543615)
<a href="https://web.ist.utl.pt/nuno.lopes/alive2/index.php?hash=2009353267698970&test=Transforms%2FInstCombine%2Fgetelementptr.ll">https://web.ist.utl.pt/nuno.lopes/alive2/index.php?hash=2009353267698970&test=Transforms%2FInstCombine%2Fgetelementptr.ll</a></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>