[llvm] [GlobalISel] Look between instructions to be matched (PR #101675)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 2 09:07:07 PDT 2024
================
@@ -70,6 +70,35 @@ bool GIMatchTableExecutor::isObviouslySafeToFold(MachineInstr &MI,
if (MI.isConvergent() && MI.getParent() != IntoMI.getParent())
return false;
- return !MI.mayLoadOrStore() && !MI.mayRaiseFPException() &&
- !MI.hasUnmodeledSideEffects() && MI.implicit_operands().empty();
+ if (!MI.mayLoadOrStore() && !MI.mayRaiseFPException() &&
+ !MI.hasUnmodeledSideEffects() && MI.implicit_operands().empty()) {
+ return true;
+ }
+
+ // If the load is simple, check instructions between MI and IntoMI
+ auto CurrMI = MI.getIterator();
+ if (MI.mayLoad() && MI.getParent() == IntoMI.getParent()) {
+ if (MI.memoperands_empty())
----------------
arsenm wrote:
This whole thing is approximately reinventing MachineInstr::hasOrderedMemoryRef or isLoadFoldBarrier
https://github.com/llvm/llvm-project/pull/101675
More information about the llvm-commits
mailing list