mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
[GreedyRA ORE] Re-factor computeNumberOfSplillsReloads.
Replace if-else to if-continue usage. This simplifies further extension of the collected stats.
This commit is contained in:
parent
b7b7a90f18
commit
7b8838be45
@ -3146,23 +3146,31 @@ RAGreedy::computeNumberOfSplillsReloads(MachineBasicBlock &MBB) {
|
||||
const MachineFrameInfo &MFI = MF->getFrameInfo();
|
||||
int FI;
|
||||
|
||||
auto isSpillSlotAccess = [&MFI](const MachineMemOperand *A) {
|
||||
return MFI.isSpillSlotObjectIndex(cast<FixedStackPseudoSourceValue>(
|
||||
A->getPseudoValue())->getFrameIndex());
|
||||
};
|
||||
for (MachineInstr &MI : MBB) {
|
||||
SmallVector<const MachineMemOperand *, 2> Accesses;
|
||||
auto isSpillSlotAccess = [&MFI](const MachineMemOperand *A) {
|
||||
return MFI.isSpillSlotObjectIndex(cast<FixedStackPseudoSourceValue>(
|
||||
A->getPseudoValue())->getFrameIndex());
|
||||
};
|
||||
|
||||
if (TII->isLoadFromStackSlot(MI, FI) && MFI.isSpillSlotObjectIndex(FI))
|
||||
if (TII->isLoadFromStackSlot(MI, FI) && MFI.isSpillSlotObjectIndex(FI)) {
|
||||
++Stats.Reloads;
|
||||
else if (TII->hasLoadFromStackSlot(MI, Accesses) &&
|
||||
llvm::any_of(Accesses, isSpillSlotAccess))
|
||||
++Stats.FoldedReloads;
|
||||
else if (TII->isStoreToStackSlot(MI, FI) && MFI.isSpillSlotObjectIndex(FI))
|
||||
continue;
|
||||
}
|
||||
if (TII->isStoreToStackSlot(MI, FI) && MFI.isSpillSlotObjectIndex(FI)) {
|
||||
++Stats.Spills;
|
||||
else if (TII->hasStoreToStackSlot(MI, Accesses) &&
|
||||
llvm::any_of(Accesses, isSpillSlotAccess))
|
||||
continue;
|
||||
}
|
||||
if (TII->hasLoadFromStackSlot(MI, Accesses) &&
|
||||
llvm::any_of(Accesses, isSpillSlotAccess)) {
|
||||
++Stats.FoldedReloads;
|
||||
continue;
|
||||
}
|
||||
Accesses.clear();
|
||||
if (TII->hasStoreToStackSlot(MI, Accesses) &&
|
||||
llvm::any_of(Accesses, isSpillSlotAccess)) {
|
||||
++Stats.FoldedSpills;
|
||||
}
|
||||
}
|
||||
return Stats;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user