[llvm] [RISCV] fix RISCVPushPopOptimizer pass (PR #110236)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 30 13:48:48 PDT 2024


================
@@ -45,10 +45,28 @@ char RISCVPushPopOpt::ID = 0;
 INITIALIZE_PASS(RISCVPushPopOpt, "riscv-push-pop-opt", RISCV_PUSH_POP_OPT_NAME,
                 false, false)
 
+template <typename IterT>
+static IterT nextNoDebugNoCFIInst(const IterT It, const IterT End) {
+  return std::find_if_not(std::next(It), End, [](const auto &Inst) {
+    return Inst.isDebugInstr() || Inst.isCFIInstruction() ||
+           Inst.isPseudoProbe();
+  });
+}
+
+static void eraseCFIInst(const MachineBasicBlock::iterator Begin,
+                         const MachineBasicBlock::iterator End) {
+  std::vector<std::reference_wrapper<llvm::MachineInstr>> CFIInstrs;
----------------
topperc wrote:

Why do we need to copy to a vector?

https://github.com/llvm/llvm-project/pull/110236


More information about the llvm-commits mailing list