[PATCH] D142084: [RFC][X86][MemFold] Upgrade the mechanism of auto-generated Memory Folding Table
Bing Yu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 15 00:40:43 PDT 2023
yubing added inline comments.
================
Comment at: llvm/utils/TableGen/X86FoldTablesEmitter.cpp:442
+ Result.CannotUnfold = BaseRegInst->isMoveReg ? true : Result.CannotUnfold;
+ } else if (RegInstr->isMoveReg && Result.IsStore)
Result.CannotUnfold = true;
----------------
skan wrote:
> Why do we need `Result.IsStore` here?
load such as VMOVAPDZ128rm will never be unfolded.
if VMOVAPDZ128rm 's memoperand is invariant, then VMOVAPDZ128rm will be hoisted directly and won't be unfolded into rm+rr
if VMOVAPDZ128rm 's memoperand is not invariant, we stop doing unfolding since compiler find it is a simple load.
```
// First check whether we should hoist this instruction.
if (!IsLoopInvariantInst(*MI) || !IsProfitableToHoist(*MI)) {
// If not, try unfolding a hoistable load.
MI = ExtractHoistableLoad(MI);
if (!MI) return false;
}
```
```
MachineInstr *MachineLICMBase::ExtractHoistableLoad(MachineInstr *MI) {
// Don't unfold simple loads.
if (MI->canFoldAsLoad())
return nullptr;
```
@craig.topper , does line429~439 make sense to you as well?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142084/new/
https://reviews.llvm.org/D142084
More information about the llvm-commits
mailing list