From 2a154d7b05fb07542d1386a00cfcec19a2dfafec Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Thu, 25 Jun 2020 18:12:55 +0100 Subject: [PATCH] LiveRangeEdit.h - reduce AliasAnalysis.h include to forward declaration. NFC. Move include to LiveRangeEdit.cpp and replace legacy AliasAnalysis typedef with AAResults where necessary. --- include/llvm/CodeGen/LiveRangeEdit.h | 12 ++++++------ lib/CodeGen/LiveRangeEdit.cpp | 11 ++++++----- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/llvm/CodeGen/LiveRangeEdit.h b/include/llvm/CodeGen/LiveRangeEdit.h index a0c5ecc3a38..7b44637ef74 100644 --- a/include/llvm/CodeGen/LiveRangeEdit.h +++ b/include/llvm/CodeGen/LiveRangeEdit.h @@ -22,7 +22,6 @@ #include "llvm/ADT/SetVector.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" -#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/CodeGen/LiveInterval.h" #include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineFunction.h" @@ -33,6 +32,7 @@ namespace llvm { +class AAResults; class LiveIntervals; class MachineBlockFrequencyInfo; class MachineInstr; @@ -94,7 +94,7 @@ private: SmallPtrSet Rematted; /// scanRemattable - Identify the Parent values that may rematerialize. - void scanRemattable(AliasAnalysis *aa); + void scanRemattable(AAResults *aa); /// allUsesAvailableAt - Return true if all registers used by OrigMI at /// OrigIdx are also available with the same value at UseIdx. @@ -110,7 +110,7 @@ private: /// Helper for eliminateDeadDefs. void eliminateDeadDef(MachineInstr *MI, ToShrinkSet &ToShrink, - AliasAnalysis *AA); + AAResults *AA); /// MachineRegisterInfo callback to notify when new virtual /// registers are created. @@ -190,12 +190,12 @@ public: /// anyRematerializable - Return true if any parent values may be /// rematerializable. /// This function must be called before any rematerialization is attempted. - bool anyRematerializable(AliasAnalysis *); + bool anyRematerializable(AAResults *); /// checkRematerializable - Manually add VNI to the list of rematerializable /// values if DefMI may be rematerializable. bool checkRematerializable(VNInfo *VNI, const MachineInstr *DefMI, - AliasAnalysis *); + AAResults *); /// Remat - Information needed to rematerialize at a specific location. struct Remat { @@ -244,7 +244,7 @@ public: /// as currently those new intervals are not guaranteed to spill. void eliminateDeadDefs(SmallVectorImpl &Dead, ArrayRef RegsBeingSpilled = None, - AliasAnalysis *AA = nullptr); + AAResults *AA = nullptr); /// calculateRegClassAndHint - Recompute register class and hint for each new /// register. diff --git a/lib/CodeGen/LiveRangeEdit.cpp b/lib/CodeGen/LiveRangeEdit.cpp index fa2285a1348..508ab20c863 100644 --- a/lib/CodeGen/LiveRangeEdit.cpp +++ b/lib/CodeGen/LiveRangeEdit.cpp @@ -12,6 +12,7 @@ #include "llvm/CodeGen/LiveRangeEdit.h" #include "llvm/ADT/Statistic.h" +#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/CodeGen/CalcSpillWeights.h" #include "llvm/CodeGen/LiveIntervals.h" #include "llvm/CodeGen/MachineRegisterInfo.h" @@ -69,7 +70,7 @@ unsigned LiveRangeEdit::createFrom(unsigned OldReg) { bool LiveRangeEdit::checkRematerializable(VNInfo *VNI, const MachineInstr *DefMI, - AliasAnalysis *aa) { + AAResults *aa) { assert(DefMI && "Missing instruction"); ScannedRemattable = true; if (!TII.isTriviallyReMaterializable(*DefMI, aa)) @@ -78,7 +79,7 @@ bool LiveRangeEdit::checkRematerializable(VNInfo *VNI, return true; } -void LiveRangeEdit::scanRemattable(AliasAnalysis *aa) { +void LiveRangeEdit::scanRemattable(AAResults *aa) { for (VNInfo *VNI : getParent().valnos) { if (VNI->isUnused()) continue; @@ -95,7 +96,7 @@ void LiveRangeEdit::scanRemattable(AliasAnalysis *aa) { ScannedRemattable = true; } -bool LiveRangeEdit::anyRematerializable(AliasAnalysis *aa) { +bool LiveRangeEdit::anyRematerializable(AAResults *aa) { if (!ScannedRemattable) scanRemattable(aa); return !Remattable.empty(); @@ -259,7 +260,7 @@ bool LiveRangeEdit::useIsKill(const LiveInterval &LI, /// Find all live intervals that need to shrink, then remove the instruction. void LiveRangeEdit::eliminateDeadDef(MachineInstr *MI, ToShrinkSet &ToShrink, - AliasAnalysis *AA) { + AAResults *AA) { assert(MI->allDefsAreDead() && "Def isn't really dead"); SlotIndex Idx = LIS.getInstructionIndex(*MI).getRegSlot(); @@ -392,7 +393,7 @@ void LiveRangeEdit::eliminateDeadDef(MachineInstr *MI, ToShrinkSet &ToShrink, void LiveRangeEdit::eliminateDeadDefs(SmallVectorImpl &Dead, ArrayRef RegsBeingSpilled, - AliasAnalysis *AA) { + AAResults *AA) { ToShrinkSet ToShrink; for (;;) {