[llvm] [X86]Add NO_REVERSE attribute to X86 RMW instrs in memfold table (PR #67288)

Shengchen Kan via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 25 19:09:26 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)
----------------
KanRobert wrote:

That sounds better.

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


More information about the llvm-commits mailing list