<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 - [GlobalISel] Volatile load duplication - isObviouslySafeToFold is too eager"
href="https://bugs.llvm.org/show_bug.cgi?id=42032">42032</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[GlobalISel] Volatile load duplication - isObviouslySafeToFold is too eager
</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>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>GlobalISel
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>alex.davies@iinet.net.au
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, quentin.colombet@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>isObviouslySafeToFold reports that any neighbouring instructions can
"obviously" be folded.
_However_, globalisel folds without ensuring deletion (as their values may
still be live), and so volatile operations can be duplicated erroneously.
One possible workaround:
bool InstructionSelector::isObviouslySafeToFold(MachineInstr &MI,
MachineInstr &IntoMI) const {
// Volatile accesses require special handling:
if (MI.mayLoadOrStore()) {
for (auto mem : MI.memoperands()) {
if (mem->isVolatile())
return false;
}
}
// Immediate neighbours are already folded.
if (MI.getParent() == IntoMI.getParent() &&
std::next(MI.getIterator()) == IntoMI.getIterator())
return !MI.mayLoadOrStore() && !MI.hasUnmodeledSideEffects() &&
empty(MI.implicit_operands());
}
But then, maybe it's time to start discussing improving this whole part of the
pattern matcher? Given that at the moment only neighbouring ld/st are
considered at all (and once fixed, not if volatile)...</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>