================ @@ -95,14 +95,24 @@ static MachineInstr *FindDominatedInstruction(MachineInstr &New, return Old; } +static bool isCodeMotionBarrier(MachineInstr &MI) { + return MI.hasUnmodeledSideEffects() && !MI.isPseudoProbe(); +} + /// Builds Instruction to its dominating order number map \p M by traversing /// from instruction \p Start. static void BuildInstOrderMap(MachineBasicBlock::iterator Start, InstOrderMap &M) { M.clear(); unsigned i = 0; - for (MachineInstr &I : make_range(Start, Start->getParent()->end())) + bool SawStore = false; + for (MachineInstr &I : make_range(Start, Start->getParent()->end())) { + if (I.mayStore()) + SawStore = true; + if (!I.isSafeToMove(SawStore) && isCodeMotionBarrier(I)) ---------------- pcc wrote:
Correct, updated this code to only call one. While reading the code I observed that the code to update SawStore in this pass is redundant with what isSafeToMove is doing, so I removed it. https://github.com/llvm/llvm-project/pull/136806 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits