<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 --- - CombineToPreIndexedLoadStore need consider ResNo in folding"
href="http://llvm.org/bugs/show_bug.cgi?id=22755">22755</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>CombineToPreIndexedLoadStore need consider ResNo in folding
</td>
</tr>
<tr>
<th>Product</th>
<td>tools
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</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>llc
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>yinma@codeaurora.org
</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>In this code
// If the offset is a constant, there may be other adds of constants that
// can be folded with this one. We should do this to avoid having to keep
// a copy of the original base pointer.
SmallVector<SDNode *, 16> OtherUses;
if (isa<ConstantSDNode>(Offset))
for (SDNode *Use : BasePtr.getNode()->uses()) {
if (Use == Ptr.getNode())
continue;
if (Use->isPredecessorOf(N))
continue;
if (Use->getOpcode() != ISD::ADD && Use->getOpcode() != ISD::SUB) {
OtherUses.clear();
break;
}
SDValue Op0 = Use->getOperand(0), Op1 = Use->getOperand(1);
if (Op1.getNode() == BasePtr.getNode())
std::swap(Op0, Op1);
assert(Op0.getNode() == BasePtr.getNode() &&
"Use of ADD/SUB but not an operand");
if (!isa<ConstantSDNode>(Op1)) {
OtherUses.clear();
break;
}
// FIXME: In some cases, we can be smarter about this.
if (Op1.getValueType() != Offset.getValueType()) {
OtherUses.clear();
break;
}
OtherUses.push_back(Use);
}
It tried to fold two adds. However, in a situation where it is a preindex load
L converted before, it is possible that
the input of one add is from the result of L and the input of another add is
from the updated index of L. These two adds cannot be combined together
clearly,
so we need check to make sure two adds are from the same ResNo by add code like
this
// FIXME: In some cases, we can be smarter about this.
if (Op1.getValueType() != Offset.getValueType()) {
OtherUses.clear();
break;
}
// Must come from the same resNo.
if (Op0.getResNo() != Ptr.getOperand(0).getResNo()) {
OtherUses.clear();
break;
}
OtherUses.push_back(Use);</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>