[llvm] Remove analysis preservations subsumed by CFG preservation. NFC (PR #212672)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 28 19:57:11 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-risc-v
Author: Fangrui Song (MaskRay)
<details>
<summary>Changes</summary>
Legacy PM: setPreservesCFG() adds every pass registered as CFG-only
(dominator/post-dominator trees, loop/cycle info, block frequency,
register class info, BasicAA, ...) to the preserved set, so a separate
addPreserved<X> for such X is a no-op, as is
addPreservedID(MachineDominatorsID) / addPreservedID(MachineLoopInfoID).
New PM: preserveSet<CFGAnalyses>() keeps every result whose invalidate()
accepts the CFGAnalyses set, making an explicit preserve<X>() on the
same PreservedAnalyses redundant. SLPVectorizer, AggressiveInstCombine
and SROA keep their explicit preserves, which are load-bearing on paths
that change the CFG.
Suggested by jmmartinez in
https://github.com/llvm/llvm-project/pull/212430#discussion_r3664131067
Aided by Claude Fable 5
---
Patch is 56.03 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/212672.diff
80 Files Affected:
- (modified) llvm/lib/CodeGen/DeadMachineInstructionElim.cpp (-1)
- (modified) llvm/lib/CodeGen/DetectDeadLanes.cpp (-1)
- (modified) llvm/lib/CodeGen/ExpandPostRAPseudos.cpp (+1-7)
- (modified) llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp (-1)
- (modified) llvm/lib/CodeGen/InitUndef.cpp (-1)
- (modified) llvm/lib/CodeGen/LiveRangeShrink.cpp (-1)
- (modified) llvm/lib/CodeGen/MachineCSE.cpp (-7)
- (modified) llvm/lib/CodeGen/MachineCombiner.cpp (-3)
- (modified) llvm/lib/CodeGen/MachineCopyPropagation.cpp (-1)
- (modified) llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp (-1)
- (modified) llvm/lib/CodeGen/MachineScheduler.cpp (-1)
- (modified) llvm/lib/CodeGen/MachineSink.cpp (-1)
- (modified) llvm/lib/CodeGen/PeepholeOptimizer.cpp (-5)
- (modified) llvm/lib/CodeGen/PostRASchedulerList.cpp (-3)
- (modified) llvm/lib/CodeGen/ProcessImplicitDefs.cpp (-1)
- (modified) llvm/lib/CodeGen/PrologEpilogInserter.cpp (+1-7)
- (modified) llvm/lib/CodeGen/RegAllocBasic.cpp (-3)
- (modified) llvm/lib/CodeGen/RegAllocGreedy.cpp (-4)
- (modified) llvm/lib/CodeGen/RegAllocPBQP.cpp (-3)
- (modified) llvm/lib/CodeGen/RegisterCoalescer.cpp (-5)
- (modified) llvm/lib/CodeGen/RemoveRedundantDebugValues.cpp (-1)
- (modified) llvm/lib/CodeGen/RenameIndependentSubregs.cpp (-1)
- (modified) llvm/lib/CodeGen/StackSlotColoring.cpp (-5)
- (modified) llvm/lib/CodeGen/TwoAddressInstructionPass.cpp (-5)
- (modified) llvm/lib/CodeGen/TypePromotion.cpp (-2)
- (modified) llvm/lib/CodeGen/XRayInstrumentation.cpp (-3)
- (modified) llvm/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp (-1)
- (modified) llvm/lib/Target/AArch64/AArch64CondBrTuning.cpp (-1)
- (modified) llvm/lib/Target/AArch64/AArch64PTrueCoalescing.cpp (-2)
- (modified) llvm/lib/Target/AArch64/AArch64PromoteConstant.cpp (-1)
- (modified) llvm/lib/Target/AArch64/AArch64SRLTDefineSuperRegs.cpp (-3)
- (modified) llvm/lib/Target/AArch64/AArch64StackTaggingPreRA.cpp (-1)
- (modified) llvm/lib/Target/AArch64/AArch64StorePairSuppress.cpp (-1)
- (modified) llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerCombiner.cpp (-1)
- (modified) llvm/lib/Target/AArch64/GISel/AArch64PreLegalizerCombiner.cpp (-2)
- (modified) llvm/lib/Target/AMDGPU/AMDGPUPostLegalizerCombiner.cpp (-1)
- (modified) llvm/lib/Target/AMDGPU/AMDGPUPreLegalizerCombiner.cpp (-1)
- (modified) llvm/lib/Target/AMDGPU/AMDGPURegBankCombiner.cpp (-1)
- (modified) llvm/lib/Target/AMDGPU/AMDGPURewriteUndefForPHI.cpp (-1)
- (modified) llvm/lib/Target/AMDGPU/GCNDPPCombine.cpp (-1)
- (modified) llvm/lib/Target/AMDGPU/SIFixSGPRCopies.cpp (-1)
- (modified) llvm/lib/Target/AMDGPU/SIFoldOperands.cpp (-1)
- (modified) llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp (-1)
- (modified) llvm/lib/Target/AMDGPU/SIOptimizeVGPRLiveRange.cpp (-5)
- (modified) llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp (-1)
- (modified) llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp (-1)
- (modified) llvm/lib/Target/ARC/ARCOptAddrMode.cpp (-1)
- (modified) llvm/lib/Target/ARM/MVETailPredication.cpp (-1)
- (modified) llvm/lib/Target/Hexagon/HexagonLiveVariables.cpp (-2)
- (modified) llvm/lib/Target/Hexagon/HexagonVLIWPacketizer.cpp (-2)
- (modified) llvm/lib/Target/Mips/MipsPostLegalizerCombiner.cpp (-1)
- (modified) llvm/lib/Target/RISCV/GISel/RISCVPostLegalizerCombiner.cpp (-1)
- (modified) llvm/lib/Target/RISCV/GISel/RISCVPreLegalizerCombiner.cpp (-1)
- (modified) llvm/lib/Target/RISCV/RISCVDeadRegisterDefinitions.cpp (-1)
- (modified) llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp (-1)
- (modified) llvm/lib/Target/SPIRV/SPIRVPreLegalizerCombiner.cpp (-1)
- (modified) llvm/lib/Target/WebAssembly/GISel/WebAssemblyPostLegalizerCombiner.cpp (-1)
- (modified) llvm/lib/Target/WebAssembly/GISel/WebAssemblyPreLegalizerCombiner.cpp (-1)
- (modified) llvm/lib/Target/WebAssembly/WebAssemblyArgumentMove.cpp (-2)
- (modified) llvm/lib/Target/WebAssembly/WebAssemblyCFGSort.cpp (-3)
- (modified) llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp (-1)
- (modified) llvm/lib/Target/WebAssembly/WebAssemblyMemIntrinsicResults.cpp (-2)
- (modified) llvm/lib/Target/WebAssembly/WebAssemblyOptimizeLiveIntervals.cpp (-2)
- (modified) llvm/lib/Target/WebAssembly/WebAssemblyOptimizeReturned.cpp (-1)
- (modified) llvm/lib/Target/WebAssembly/WebAssemblyRegColoring.cpp (-2)
- (modified) llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp (-2)
- (modified) llvm/lib/Target/WebAssembly/WebAssemblySetP2AlignOperands.cpp (-2)
- (modified) llvm/lib/Target/X86/GISel/X86PostLegalizerCombiner.cpp (-1)
- (modified) llvm/lib/Target/X86/GISel/X86PreLegalizerCombiner.cpp (-1)
- (modified) llvm/lib/Target/X86/X86ExpandPseudo.cpp (-3)
- (modified) llvm/lib/Transforms/InstCombine/InstructionCombining.cpp (-2)
- (modified) llvm/lib/Transforms/Scalar/ConstraintElimination.cpp (-2)
- (modified) llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp (-3)
- (modified) llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp (-2)
- (modified) llvm/lib/Transforms/Scalar/NaryReassociate.cpp (-1)
- (modified) llvm/lib/Transforms/Scalar/Reassociate.cpp (-1)
- (modified) llvm/lib/Transforms/Scalar/Sink.cpp (-2)
- (modified) llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp (-1)
- (modified) llvm/lib/Transforms/Utils/LCSSA.cpp (-4)
- (modified) llvm/lib/Transforms/Utils/MoveAutoInit.cpp (-1)
``````````diff
diff --git a/llvm/lib/CodeGen/DeadMachineInstructionElim.cpp b/llvm/lib/CodeGen/DeadMachineInstructionElim.cpp
index 28c291b22a66a..0d31b83a486e2 100644
--- a/llvm/lib/CodeGen/DeadMachineInstructionElim.cpp
+++ b/llvm/lib/CodeGen/DeadMachineInstructionElim.cpp
@@ -56,7 +56,6 @@ class DeadMachineInstructionElim : public MachineFunctionPass {
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG();
- AU.addPreserved<MachineRegisterClassInfoWrapperPass>();
MachineFunctionPass::getAnalysisUsage(AU);
}
};
diff --git a/llvm/lib/CodeGen/DetectDeadLanes.cpp b/llvm/lib/CodeGen/DetectDeadLanes.cpp
index fdc5687885bd8..13ac076d75bf5 100644
--- a/llvm/lib/CodeGen/DetectDeadLanes.cpp
+++ b/llvm/lib/CodeGen/DetectDeadLanes.cpp
@@ -398,7 +398,6 @@ struct DetectDeadLanesLegacy : public MachineFunctionPass {
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG();
- AU.addPreserved<MachineRegisterClassInfoWrapperPass>();
MachineFunctionPass::getAnalysisUsage(AU);
}
diff --git a/llvm/lib/CodeGen/ExpandPostRAPseudos.cpp b/llvm/lib/CodeGen/ExpandPostRAPseudos.cpp
index 0131cded121c3..32d11ff73bd6c 100644
--- a/llvm/lib/CodeGen/ExpandPostRAPseudos.cpp
+++ b/llvm/lib/CodeGen/ExpandPostRAPseudos.cpp
@@ -46,9 +46,6 @@ struct ExpandPostRALegacy : public MachineFunctionPass {
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG();
- AU.addPreservedID(MachineLoopInfoID);
- AU.addPreservedID(MachineDominatorsID);
- AU.addPreserved<MachineRegisterClassInfoWrapperPass>();
MachineFunctionPass::getAnalysisUsage(AU);
}
@@ -63,10 +60,7 @@ ExpandPostRAPseudosPass::run(MachineFunction &MF,
if (!ExpandPostRA().run(MF))
return PreservedAnalyses::all();
- return getMachineFunctionPassPreservedAnalyses()
- .preserveSet<CFGAnalyses>()
- .preserve<MachineLoopAnalysis>()
- .preserve<MachineDominatorTreeAnalysis>();
+ return getMachineFunctionPassPreservedAnalyses().preserveSet<CFGAnalyses>();
}
char ExpandPostRALegacy::ID = 0;
diff --git a/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp b/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp
index 8c651480c5bc0..fb7b9d306b4e4 100644
--- a/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp
+++ b/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp
@@ -71,7 +71,6 @@ class FixupStatepointCallerSavedLegacy : public MachineFunctionPass {
FixupStatepointCallerSavedLegacy() : MachineFunctionPass(ID) {}
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG();
- AU.addPreserved<MachineRegisterClassInfoWrapperPass>();
MachineFunctionPass::getAnalysisUsage(AU);
}
diff --git a/llvm/lib/CodeGen/InitUndef.cpp b/llvm/lib/CodeGen/InitUndef.cpp
index bf85ce3c77bb0..f16f90d7a7fa3 100644
--- a/llvm/lib/CodeGen/InitUndef.cpp
+++ b/llvm/lib/CodeGen/InitUndef.cpp
@@ -71,7 +71,6 @@ class InitUndefLegacy : public MachineFunctionPass {
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG();
- AU.addPreserved<MachineRegisterClassInfoWrapperPass>();
MachineFunctionPass::getAnalysisUsage(AU);
}
diff --git a/llvm/lib/CodeGen/LiveRangeShrink.cpp b/llvm/lib/CodeGen/LiveRangeShrink.cpp
index a363fca456e23..a7c889e84fc26 100644
--- a/llvm/lib/CodeGen/LiveRangeShrink.cpp
+++ b/llvm/lib/CodeGen/LiveRangeShrink.cpp
@@ -49,7 +49,6 @@ class LiveRangeShrink : public MachineFunctionPass {
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG();
- AU.addPreserved<MachineRegisterClassInfoWrapperPass>();
MachineFunctionPass::getAnalysisUsage(AU);
}
diff --git a/llvm/lib/CodeGen/MachineCSE.cpp b/llvm/lib/CodeGen/MachineCSE.cpp
index c0954235af6c5..75a6ad8d6f3c2 100644
--- a/llvm/lib/CodeGen/MachineCSE.cpp
+++ b/llvm/lib/CodeGen/MachineCSE.cpp
@@ -144,12 +144,8 @@ class MachineCSELegacy : public MachineFunctionPass {
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG();
MachineFunctionPass::getAnalysisUsage(AU);
- AU.addPreservedID(MachineLoopInfoID);
AU.addRequired<MachineDominatorTreeWrapperPass>();
- AU.addPreserved<MachineDominatorTreeWrapperPass>();
AU.addRequired<MachineBlockFrequencyInfoWrapperPass>();
- AU.addPreserved<MachineBlockFrequencyInfoWrapperPass>();
- AU.addPreserved<MachineRegisterClassInfoWrapperPass>();
}
MachineFunctionProperties getRequiredProperties() const override {
@@ -961,9 +957,6 @@ PreservedAnalyses MachineCSEPass::run(MachineFunction &MF,
return PreservedAnalyses::all();
auto PA = getMachineFunctionPassPreservedAnalyses();
- PA.preserve<MachineLoopAnalysis>();
- PA.preserve<MachineDominatorTreeAnalysis>();
- PA.preserve<MachineBlockFrequencyAnalysis>();
PA.preserveSet<CFGAnalyses>();
return PA;
}
diff --git a/llvm/lib/CodeGen/MachineCombiner.cpp b/llvm/lib/CodeGen/MachineCombiner.cpp
index 338aeeb350c4d..a8b76e6c93346 100644
--- a/llvm/lib/CodeGen/MachineCombiner.cpp
+++ b/llvm/lib/CodeGen/MachineCombiner.cpp
@@ -133,11 +133,8 @@ INITIALIZE_PASS_END(MachineCombiner, DEBUG_TYPE, "Machine InstCombiner",
void MachineCombiner::getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesCFG();
- AU.addPreserved<MachineDominatorTreeWrapperPass>();
AU.addRequired<MachineLoopInfoWrapperPass>();
- AU.addPreserved<MachineLoopInfoWrapperPass>();
AU.addRequired<MachineRegisterClassInfoWrapperPass>();
- AU.addPreserved<MachineRegisterClassInfoWrapperPass>();
AU.addRequired<MachineTraceMetricsWrapperPass>();
AU.addPreserved<MachineTraceMetricsWrapperPass>();
AU.addRequired<LazyMachineBlockFrequencyInfoPass>();
diff --git a/llvm/lib/CodeGen/MachineCopyPropagation.cpp b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
index 4d3e673b0ff4a..a8a8839cb00c9 100644
--- a/llvm/lib/CodeGen/MachineCopyPropagation.cpp
+++ b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
@@ -554,7 +554,6 @@ class MachineCopyPropagationLegacy : public MachineFunctionPass {
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG();
- AU.addPreserved<MachineRegisterClassInfoWrapperPass>();
MachineFunctionPass::getAnalysisUsage(AU);
}
diff --git a/llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp b/llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp
index 79317d3781c14..55080338a234d 100644
--- a/llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp
+++ b/llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp
@@ -73,7 +73,6 @@ class MachineLateInstrsCleanupLegacy : public MachineFunctionPass {
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG();
- AU.addPreserved<MachineRegisterClassInfoWrapperPass>();
MachineFunctionPass::getAnalysisUsage(AU);
}
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp
index 28fa5a6260546..a92b1086a8438 100644
--- a/llvm/lib/CodeGen/MachineScheduler.cpp
+++ b/llvm/lib/CodeGen/MachineScheduler.cpp
@@ -424,7 +424,6 @@ void MachineSchedulerLegacy::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<LiveIntervalsWrapperPass>();
AU.addPreserved<LiveIntervalsWrapperPass>();
AU.addRequired<MachineRegisterClassInfoWrapperPass>();
- AU.addPreserved<MachineRegisterClassInfoWrapperPass>();
AU.addRequired<MachineBlockFrequencyInfoWrapperPass>();
MachineFunctionPass::getAnalysisUsage(AU);
}
diff --git a/llvm/lib/CodeGen/MachineSink.cpp b/llvm/lib/CodeGen/MachineSink.cpp
index c909b07c80c62..d097c8f1268f3 100644
--- a/llvm/lib/CodeGen/MachineSink.cpp
+++ b/llvm/lib/CodeGen/MachineSink.cpp
@@ -2112,7 +2112,6 @@ class PostRAMachineSinkingLegacy : public MachineFunctionPass {
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG();
- AU.addPreserved<MachineRegisterClassInfoWrapperPass>();
MachineFunctionPass::getAnalysisUsage(AU);
}
diff --git a/llvm/lib/CodeGen/PeepholeOptimizer.cpp b/llvm/lib/CodeGen/PeepholeOptimizer.cpp
index df04537fd6a1e..d46ace0bdd748 100644
--- a/llvm/lib/CodeGen/PeepholeOptimizer.cpp
+++ b/llvm/lib/CodeGen/PeepholeOptimizer.cpp
@@ -575,11 +575,8 @@ class PeepholeOptimizerLegacy : public MachineFunctionPass {
AU.setPreservesCFG();
MachineFunctionPass::getAnalysisUsage(AU);
AU.addRequired<MachineLoopInfoWrapperPass>();
- AU.addPreserved<MachineLoopInfoWrapperPass>();
- AU.addPreserved<MachineRegisterClassInfoWrapperPass>();
if (Aggressive) {
AU.addRequired<MachineDominatorTreeWrapperPass>();
- AU.addPreserved<MachineDominatorTreeWrapperPass>();
}
}
@@ -1724,8 +1721,6 @@ PeepholeOptimizerPass::run(MachineFunction &MF,
return PreservedAnalyses::all();
auto PA = getMachineFunctionPassPreservedAnalyses();
- PA.preserve<MachineDominatorTreeAnalysis>();
- PA.preserve<MachineLoopAnalysis>();
PA.preserveSet<CFGAnalyses>();
return PA;
}
diff --git a/llvm/lib/CodeGen/PostRASchedulerList.cpp b/llvm/lib/CodeGen/PostRASchedulerList.cpp
index df6a942bf2009..525b46cbc62b1 100644
--- a/llvm/lib/CodeGen/PostRASchedulerList.cpp
+++ b/llvm/lib/CodeGen/PostRASchedulerList.cpp
@@ -100,11 +100,8 @@ class PostRASchedulerLegacy : public MachineFunctionPass {
AU.setPreservesCFG();
AU.addRequired<AAResultsWrapperPass>();
AU.addRequired<TargetPassConfig>();
- AU.addPreserved<MachineDominatorTreeWrapperPass>();
AU.addRequired<MachineLoopInfoWrapperPass>();
- AU.addPreserved<MachineLoopInfoWrapperPass>();
AU.addRequired<MachineRegisterClassInfoWrapperPass>();
- AU.addPreserved<MachineRegisterClassInfoWrapperPass>();
MachineFunctionPass::getAnalysisUsage(AU);
}
diff --git a/llvm/lib/CodeGen/ProcessImplicitDefs.cpp b/llvm/lib/CodeGen/ProcessImplicitDefs.cpp
index 979f6726b1af4..142e0b084a0e8 100644
--- a/llvm/lib/CodeGen/ProcessImplicitDefs.cpp
+++ b/llvm/lib/CodeGen/ProcessImplicitDefs.cpp
@@ -67,7 +67,6 @@ INITIALIZE_PASS(ProcessImplicitDefsLegacy, DEBUG_TYPE,
void ProcessImplicitDefsLegacy::getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesCFG();
AU.addPreserved<AAResultsWrapperPass>();
- AU.addPreserved<MachineRegisterClassInfoWrapperPass>();
MachineFunctionPass::getAnalysisUsage(AU);
}
diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
index c033079ef8370..4cfce20465e21 100644
--- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp
+++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
@@ -162,10 +162,7 @@ STATISTIC(NumBytesStackSpace,
void PEILegacy::getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesCFG();
- AU.addPreserved<MachineLoopInfoWrapperPass>();
- AU.addPreserved<MachineDominatorTreeWrapperPass>();
AU.addRequired<MachineOptimizationRemarkEmitterPass>();
- AU.addPreserved<MachineRegisterClassInfoWrapperPass>();
MachineFunctionPass::getAnalysisUsage(AU);
}
@@ -367,10 +364,7 @@ PrologEpilogInserterPass::run(MachineFunction &MF,
if (!PEIImpl(&ORE).run(MF))
return PreservedAnalyses::all();
- return getMachineFunctionPassPreservedAnalyses()
- .preserveSet<CFGAnalyses>()
- .preserve<MachineDominatorTreeAnalysis>()
- .preserve<MachineLoopAnalysis>();
+ return getMachineFunctionPassPreservedAnalyses().preserveSet<CFGAnalyses>();
}
/// Calculate the MaxCallFrameSize variable for the function's frame
diff --git a/llvm/lib/CodeGen/RegAllocBasic.cpp b/llvm/lib/CodeGen/RegAllocBasic.cpp
index 0b2a73b3c7e0f..0d8a6970b41e7 100644
--- a/llvm/lib/CodeGen/RegAllocBasic.cpp
+++ b/llvm/lib/CodeGen/RegAllocBasic.cpp
@@ -100,12 +100,9 @@ void RABasic::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addPreserved<LiveStacksWrapperLegacy>();
AU.addRequired<ProfileSummaryInfoWrapperPass>();
AU.addRequired<MachineBlockFrequencyInfoWrapperPass>();
- AU.addPreserved<MachineBlockFrequencyInfoWrapperPass>();
AU.addRequired<MachineDominatorTreeWrapperPass>();
AU.addRequiredID(MachineDominatorsID);
- AU.addPreservedID(MachineDominatorsID);
AU.addRequired<MachineLoopInfoWrapperPass>();
- AU.addPreserved<MachineLoopInfoWrapperPass>();
AU.addRequired<VirtRegMapWrapperLegacy>();
AU.addPreserved<VirtRegMapWrapperLegacy>();
AU.addRequired<LiveRegMatrixWrapperLegacy>();
diff --git a/llvm/lib/CodeGen/RegAllocGreedy.cpp b/llvm/lib/CodeGen/RegAllocGreedy.cpp
index 6b8a9b8190f9a..56e659a7d7762 100644
--- a/llvm/lib/CodeGen/RegAllocGreedy.cpp
+++ b/llvm/lib/CodeGen/RegAllocGreedy.cpp
@@ -258,7 +258,6 @@ PreservedAnalyses RAGreedyPass::run(MachineFunction &MF,
return PreservedAnalyses::all();
auto PA = getMachineFunctionPassPreservedAnalyses();
PA.preserveSet<CFGAnalyses>();
- PA.preserve<MachineBlockFrequencyAnalysis>();
PA.preserve<LiveIntervalsAnalysis>();
PA.preserve<SlotIndexesAnalysis>();
PA.preserve<LiveDebugVariablesAnalysis>();
@@ -342,7 +341,6 @@ FunctionPass *llvm::createGreedyRegisterAllocator(RegAllocFilterFunc Ftor) {
void RAGreedyLegacy::getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesCFG();
AU.addRequired<MachineBlockFrequencyInfoWrapperPass>();
- AU.addPreserved<MachineBlockFrequencyInfoWrapperPass>();
AU.addRequired<LiveIntervalsWrapperPass>();
AU.addPreserved<LiveIntervalsWrapperPass>();
AU.addRequired<SlotIndexesWrapperPass>();
@@ -352,9 +350,7 @@ void RAGreedyLegacy::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<LiveStacksWrapperLegacy>();
AU.addPreserved<LiveStacksWrapperLegacy>();
AU.addRequired<MachineDominatorTreeWrapperPass>();
- AU.addPreserved<MachineDominatorTreeWrapperPass>();
AU.addRequired<MachineLoopInfoWrapperPass>();
- AU.addPreserved<MachineLoopInfoWrapperPass>();
AU.addRequired<VirtRegMapWrapperLegacy>();
AU.addPreserved<VirtRegMapWrapperLegacy>();
AU.addRequired<LiveRegMatrixWrapperLegacy>();
diff --git a/llvm/lib/CodeGen/RegAllocPBQP.cpp b/llvm/lib/CodeGen/RegAllocPBQP.cpp
index 28c079c5dcbb7..0650692962efa 100644
--- a/llvm/lib/CodeGen/RegAllocPBQP.cpp
+++ b/llvm/lib/CodeGen/RegAllocPBQP.cpp
@@ -546,11 +546,8 @@ void RegAllocPBQP::getAnalysisUsage(AnalysisUsage &au) const {
au.addRequired<LiveStacksWrapperLegacy>();
au.addPreserved<LiveStacksWrapperLegacy>();
au.addRequired<MachineBlockFrequencyInfoWrapperPass>();
- au.addPreserved<MachineBlockFrequencyInfoWrapperPass>();
au.addRequired<MachineLoopInfoWrapperPass>();
- au.addPreserved<MachineLoopInfoWrapperPass>();
au.addRequired<MachineDominatorTreeWrapperPass>();
- au.addPreserved<MachineDominatorTreeWrapperPass>();
au.addRequired<VirtRegMapWrapperLegacy>();
au.addPreserved<VirtRegMapWrapperLegacy>();
MachineFunctionPass::getAnalysisUsage(au);
diff --git a/llvm/lib/CodeGen/RegisterCoalescer.cpp b/llvm/lib/CodeGen/RegisterCoalescer.cpp
index b61a87a2ee497..fae504c7c9cba 100644
--- a/llvm/lib/CodeGen/RegisterCoalescer.cpp
+++ b/llvm/lib/CodeGen/RegisterCoalescer.cpp
@@ -606,10 +606,7 @@ void RegisterCoalescerLegacy::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addPreserved<LiveIntervalsWrapperPass>();
AU.addPreserved<SlotIndexesWrapperPass>();
AU.addRequired<MachineLoopInfoWrapperPass>();
- AU.addPreserved<MachineLoopInfoWrapperPass>();
- AU.addPreservedID(MachineDominatorsID);
AU.addRequired<MachineRegisterClassInfoWrapperPass>();
- AU.addPreserved<MachineRegisterClassInfoWrapperPass>();
MachineFunctionPass::getAnalysisUsage(AU);
}
@@ -4306,8 +4303,6 @@ RegisterCoalescerPass::run(MachineFunction &MF,
PA.preserveSet<CFGAnalyses>();
PA.preserve<LiveIntervalsAnalysis>();
PA.preserve<SlotIndexesAnalysis>();
- PA.preserve<MachineLoopAnalysis>();
- PA.preserve<MachineDominatorTreeAnalysis>();
return PA;
}
diff --git a/llvm/lib/CodeGen/RemoveRedundantDebugValues.cpp b/llvm/lib/CodeGen/RemoveRedundantDebugValues.cpp
index c144a67394c6e..0c3512815a064 100644
--- a/llvm/lib/CodeGen/RemoveRedundantDebugValues.cpp
+++ b/llvm/lib/CodeGen/RemoveRedundantDebugValues.cpp
@@ -49,7 +49,6 @@ class RemoveRedundantDebugValuesLegacy : public MachineFunctionPass {
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG();
- AU.addPreserved<MachineRegisterClassInfoWrapperPass>();
MachineFunctionPass::getAnalysisUsage(AU);
}
};
diff --git a/llvm/lib/CodeGen/RenameIndependentSubregs.cpp b/llvm/lib/CodeGen/RenameIndependentSubregs.cpp
index 67759f448c8e7..8e75fec8e1139 100644
--- a/llvm/lib/CodeGen/RenameIndependentSubregs.cpp
+++ b/llvm/lib/CodeGen/RenameIndependentSubregs.cpp
@@ -109,7 +109,6 @@ class RenameIndependentSubregsLegacy : public MachineFunctionPass {
AU.addPreserved<LiveIntervalsWrapperPass>();
AU.addRequired<SlotIndexesWrapperPass>();
AU.addPreserved<SlotIndexesWrapperPass>();
- AU.addPreserved<MachineRegisterClassInfoWrapperPass>();
MachineFunctionPass::getAnalysisUsage(AU);
}
};
diff --git a/llvm/lib/CodeGen/StackSlotColoring.cpp b/llvm/lib/CodeGen/StackSlotColoring.cpp
index f4e7724d6361a..63991be866875 100644
--- a/llvm/lib/CodeGen/StackSlotColoring.cpp
+++ b/llvm/lib/CodeGen/StackSlotColoring.cpp
@@ -166,13 +166,10 @@ class StackSlotColoringLegacy : public MachineFunctionPass {
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG();
- AU.addPreserved<MachineRegisterClassInfoWrapperPass>();
AU.addRequired<SlotIndexesWrapperPass>();
AU.addPreserved<SlotIndexesWrapperPass>();
AU.addRequired<LiveStacksWrapperLegacy>();
AU.addRequired<MachineBlockFrequencyInfoWrapperPass>();
- AU.addPreserved<MachineBlockFrequencyInfoWrapperPass>();
- AU.addPreservedID(MachineDominatorsID);
// In some Target's pipeline, register allocation (RA) might be
// split into multiple phases based on register class. So, this pass
@@ -594,8 +591,6 @@ StackSlotColoringPass::run(MachineFunction &MF,
auto PA = getMachineFunctionPassPreservedAnalyses();
PA.preserveSet<CFGAnalyses>();
PA.preserve<SlotIndexesAnalysis>();
- PA.preserve<MachineBlockFrequencyAnalysis>();
- PA.preserve<MachineDominatorTreeAnalysis>();
PA.preserve<LiveIntervalsAnalysis>();
PA.preserve<LiveDebugVariablesAnalysis>();
return PA;
diff --git a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
index 7da00951c093e..3b81d0c94eba6 100644
--- a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
+++ b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
@@ -225,9 +225,6 @@ class TwoAddressInstructionLegacyPass : public MachineFunctionPass {
AU.addPreserved<LiveVariablesWrapperPass>();
AU.addPreserved<SlotIndexesWrapperPass>();
AU.addPreserved<LiveIntervalsWrapperPass>();
- AU.addPreservedID(MachineLoopInfoID);
- AU.addPreservedID(MachineDominatorsID);
- AU.addPreserved<MachineRegisterClassInfoWrapperPass>();
MachineFunctionPass::getAnalysisUsage(AU);
}
};
@@ -258,8 +255,6 @@ TwoAddressInstructionPass::run(MachineFunction &MF,
PA.preserve<LiveVariablesAnalysis>();
PA.preserve<LiveIntervalsAnalysis>();
- PA.preserve<MachineDominatorTreeAnalysis>();
- PA.preserve<MachineLoopAnalysis>();
PA.preserveSet<CFGAnalyses>();
return PA;
}
diff --git a/llvm/lib/CodeGen/TypePromotion.cpp b/llvm/lib/CodeGen/TypePromotion.cpp
index 77f82b3851904..507ee820975ac 100644
--- a/llvm/lib/CodeGen/TypePromotion.cpp
+++ b/llvm/lib/CodeGen/TypePromotion.cpp
@@ -188,7 +188,6 @@ class TypePromotionLegacy : public FunctionPass {
AU.addRequired<TargetTransformInfoWrapperPass>();
AU.addRequired<TargetPassConfig>();
AU.setPreservesCFG();
- AU.addPreserved<LoopInfoWrapperPass>();
}
StringRef getPassName() const override { return PASS_NAME; }
@@ -1058,6 +1057,5 @@ PreservedAnalyses TypePromotionPass::run(Function &F,
PreservedAnalyses PA;
PA.preserveSet<CFGAnalyses>();
- PA.preserve<LoopAnalysis>();
return PA;
}
diff --git a/llvm/lib/CodeGen/XRayInstrumentation.cpp b/llvm/lib/CodeGen/XRayInstrumentation.cpp
index b9cc60820be8c..f23357ef0bd17 100644
--- a/llvm/lib/CodeGen/XRayInstrumentation.cpp
+++ b/llvm/lib/CodeGen/XRayInstrumentation.cpp
@@ -55,9 +55,6 @@ struct XRayInstrumentationLegacy : public MachineFunctionPass {
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG();
- AU.addPreserved<MachineLoopInfoWrapperPass>();
- AU.addPreserved<MachineDominatorTreeWrapperPass>();
- AU.addPreserved<MachineRegisterClassInfoWrapperPass>();
MachineFunctionPass::getAnalysisUsage(AU);
}
...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/212672
More information about the llvm-commits
mailing list