[llvm] [MCA][X86] Pretend To Have a Stack Engine (PR #153348)
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 13 22:35:58 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();
+ }
----------------
boomanaiden154 wrote:
Ah, true.
This ended up being more complicated than I thought. We can't just disable the read dependency for instructions following an initial stack operation because then the subsequent stack operations can execute out of order with an instruction setting rsp. Getting rid of the write would theoretically work, but would require modifying the previous instruction inside the instruction processor (if we see the current instruction is also a stack operation), which doesn't fit well within an MCAD type workflow like the one we're using.
I'll have to think about this one a bit more and figure out what would actually work.
https://github.com/llvm/llvm-project/pull/153348
More information about the llvm-commits
mailing list