<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 - Incorrect removal of entries in PressureDiff::addPressureChange"
href="https://bugs.llvm.org/show_bug.cgi?id=37252">37252</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Incorrect removal of entries in PressureDiff::addPressureChange
</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>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>Common Code Generator Code
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>tetra2005@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>I've recently came across a weird behavior in addPressureChange function. The
problematic commit is r250595:
+ // Remove entry
+ PressureDiff::iterator J;
+ for (J = std::next(I); J != E && J->isValid(); ++J, ++I)
+ *I = *J;
+ if (J != E)
+ *I = *J;
This code is that it fails to reset isValid() status on last element of
PressureDiff::PressureChanges i.e. if J == E (and thus I == E – 1). In such
case the last two elements of PressureChanges hold
the same PSetID:
...
+ [13] {PSetID=242 UnitInc=-6 } llvm::PressureChange
+ [14] {PSetID=249 UnitInc=-6 } llvm::PressureChange
+ [15] {PSetID=249 UnitInc=-6 } llvm::PressureChange
Apart from making debug output in updatePressureDiffs weird (as it prints these
trailing duplicate elements) this effectively steals 1 location in
PressureChange because now PSetIDs which are greater than 249 will not be
stored there.
Maybe the last 2 lines should instead be changed to
*I = PressureChange();
?
I'm on a private branch so don't have a ready-made reproducer but hopefully
description above makes sense as is...</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>