[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 00:35:48 PDT 2023


XinWang10 wrote:

The function unfoldMemoryOperand called in below:
`1. CodeGen/TwoAddressInstructionPass.cpp:1326:        if (!TII->unfoldMemoryOperand(*MF, MI, Reg,
2. CodeGen/MachineLICM.cpp:1268:  bool Success = TII->unfoldMemoryOperand(MF, *MI, Reg,
3. CodeGen/MachineLICM.cpp:1273:         "unfoldMemoryOperand failed when getOpcodeAfterMemoryUnfold "
4. CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:986:  if (!TII->unfoldMemoryOperand(*DAG, N, NewNodes))
5. CodeGen/SelectionDAG/ScheduleDAGFast.cpp:231:    if (!TII->unfoldMemoryOperand(*DAG, N, NewNodes))
6. Target/X86/X86SpeculativeLoadHardening.cpp:915:            TII->unfoldMemoryOperand(MF, MI, Reg, /*UnfoldLoad*/ true,
7. Target/X86/X86CmovConversion.cpp:780:    bool Unfolded = TII->unfoldMemoryOperand(*MBB->getParent(), MI, TmpReg,
8. Target/X86/X86ISelLowering.cpp:57256:    if (!TII->unfoldMemoryOperand(MF, *OrigCall, X86::R11, /*UnfoldLoad=*/true,`
The callers except 4,5 use 
`        if (!TII->unfoldMemoryOperand(*MF, MI, Reg,
                                      /*UnfoldLoad=*/true,
                                      /*UnfoldStore=*/false, NewMIs)) {`
which denote it would not fold RMW, and callers 4,5 use
`  if (!TII->unfoldMemoryOperand(*DAG, N, NewNodes))
    return nullptr;

  // unfolding an x86 DEC64m operation results in store, dec, load which
  // can't be handled here so quit
  if (NewNodes.size() == 3)
    return nullptr;

  assert(NewNodes.size() == 2 && "Expected a load folding node!");`
RMW could not be handled here.

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


More information about the llvm-commits mailing list