[llvm] [MCA][X86] Pretend To Have a Stack Engine (PR #153348)

Andrea Di Biagio via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 14 03:59:17 PDT 2025


================
@@ -36,11 +36,31 @@ void X86InstrPostProcess::setMemBarriers(std::unique_ptr<Instruction> &Inst,
   }
 }
 
+void X86InstrPostProcess::useStackEngine(std::unique_ptr<Instruction> &Inst,
+                                         const MCInst &MCI) {
+  if (X86::isPOP(MCI.getOpcode())) {
+    assert(Inst->getUses().size() == 1 &&
+           "Expected pop instruction to only use stack pointer register");
+    Inst->getUses().clear();
+  }
----------------
adibiagio wrote:

I don't remember the custom-behaviour / instr postprocess mechanism.
However, can we add artificial dependencies (similar to chain deps in DAG) for POP instructions, so that they are always guaranteed to executed in-order? Maybe @mshockwave  knows the answer to it.

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


More information about the llvm-commits mailing list