[PATCH] D128539: [GISel] Don't fold convergent instruction across CFG
Quentin Colombet via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 24 09:55:05 PDT 2022
qcolombet created this revision.
qcolombet added reviewers: arsenm, aemerson, paquette.
Herald added a subscriber: hiraditya.
Herald added a project: All.
qcolombet requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.
Before merging two instructions together, GISel does some sanity checks that the folding is legal.
However that check was missing that the source of the pattern may be convergent. When the destination location is in a different basic block, the folding is invalid.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D128539
Files:
llvm/lib/CodeGen/GlobalISel/InstructionSelector.cpp
Index: llvm/lib/CodeGen/GlobalISel/InstructionSelector.cpp
===================================================================
--- llvm/lib/CodeGen/GlobalISel/InstructionSelector.cpp
+++ llvm/lib/CodeGen/GlobalISel/InstructionSelector.cpp
@@ -59,6 +59,10 @@
std::next(MI.getIterator()) == IntoMI.getIterator())
return true;
+ // Convergent instructions cannot be moved in the CFG.
+ if (MI.isConvergent() && MI.getParent() != IntoMI.getParent())
+ return false;
+
return !MI.mayLoadOrStore() && !MI.mayRaiseFPException() &&
!MI.hasUnmodeledSideEffects() && MI.implicit_operands().empty();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128539.439805.patch
Type: text/x-patch
Size: 624 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220624/5cea1c7f/attachment.bin>
More information about the llvm-commits
mailing list