https://bugs.llvm.org/show_bug.cgi?id=42032
Bug ID: 42032
Summary: [GlobalISel] Volatile load duplication -
isObviouslySafeToFold is too eager
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: GlobalISel
Assignee: unassignedb...@nondot.org
Reporter: alex.dav...@iinet.net.au
CC: llvm-bugs@lists.llvm.org, quentin.colom...@gmail.com
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)...
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs