[llvm] [MCA][X86] Pretend To Have a Stack Engine (PR #153348)
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 15 08:38:21 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:
<img width="705" height="281" alt="image" src="https://github.com/user-attachments/assets/28050f7f-c83f-4bcf-b834-939281c8ce2b" />
(My previous example on uiCA was bad, because the register would just get renamed. Here it models stack sync uops).
Keeping the writes around for the stack operations would mean that the `add` instruction in the second iteration could only finish executing after the last `pop` instruction in the first iteration. While completely ignoring the stack sync uop does makes us less accurate here, keeping the write would make us significantly less accurate.
https://github.com/llvm/llvm-project/pull/153348
More information about the llvm-commits
mailing list