[llvm] [X86]Add NO_REVERSE attribute to X86 RMW instrs in memfold table (PR #67288)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 25 19:00:23 PDT 2023
================
@@ -433,7 +433,9 @@ void X86FoldTablesEmitter::addEntryWithFlags(FoldTable &Table,
// the unfolded load size will be based on the register size. If that’s bigger
// than the memory operand size, the unfolded load will load more memory and
// potentially cause a memory fault.
- if (getRegOperandSize(RegOpRec) > getMemOperandSize(MemOpRec))
+ // And X86 would not unfold RMW instrs.
+ if (getRegOperandSize(RegOpRec) > getMemOperandSize(MemOpRec) ||
+ &Table == &Table2Addr)
----------------
XinWang10 wrote:
We could add it in outer caller,
` // Instructions which Read-Modify-Write should be added to Table2Addr.
if (!MemOutSize && RegOutSize == 1 && MemInSize == RegInSize) {
addEntryWithFlags(Table2Addr, RegInstr, MemInstr, S | TB_NO_REVERSE, 0, IsManual);
return;
}`
Maybe this could be better?
https://github.com/llvm/llvm-project/pull/67288
More information about the llvm-commits
mailing list