Skip to content

[CodeGen][PM] Initialize analyses with isAnalysis=true #118779

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

optimisan
Copy link
Contributor

@optimisan optimisan commented Dec 5, 2024

Analyses should be marked as analyses.

Otherwise they are prone to get ignored by the legacy analysis cache mechanism and get scheduled redundantly.

Copy link
Contributor Author

optimisan commented Dec 5, 2024

@optimisan optimisan force-pushed the users/Akshat-Oke/12-05-_codegen_newpm_port_livestacks_analysis_to_npm branch from 949e14d to 7e6d9ff Compare December 5, 2024 10:11
@optimisan optimisan force-pushed the users/Akshat-Oke/12-05-_codegen_pm_initialize_analyses_with_isanalysis_true branch from d9e5fac to 13da564 Compare December 5, 2024 10:17
@optimisan optimisan marked this pull request as ready for review December 5, 2024 10:19
@llvmbot
Copy link
Member

llvmbot commented Dec 5, 2024

@llvm/pr-subscribers-llvm-regalloc
@llvm/pr-subscribers-llvm-transforms

@llvm/pr-subscribers-debuginfo

Author: Akshat Oke (optimisan)

Changes

Analyses should be marked as analyses.

Otherwise they are prone to get ignored by the legacy analysis cache mechanism and get scheduled redundantly.


Full diff: https://github.com/llvm/llvm-project/pull/118779.diff

8 Files Affected:

  • (modified) llvm/lib/CodeGen/GCMetadata.cpp (+1-1)
  • (modified) llvm/lib/CodeGen/LiveDebugVariables.cpp (+1-1)
  • (modified) llvm/lib/CodeGen/LiveIntervals.cpp (+1-1)
  • (modified) llvm/lib/CodeGen/LiveRegMatrix.cpp (+1-1)
  • (modified) llvm/lib/CodeGen/LiveStacks.cpp (+1-1)
  • (modified) llvm/lib/CodeGen/SlotIndexes.cpp (+1-1)
  • (modified) llvm/lib/CodeGen/VirtRegMap.cpp (+1-1)
  • (modified) llvm/lib/Transforms/Utils/LoopSimplify.cpp (+2-2)
diff --git a/llvm/lib/CodeGen/GCMetadata.cpp b/llvm/lib/CodeGen/GCMetadata.cpp
index 6d1cc1a58e27df..f33008c9e0f232 100644
--- a/llvm/lib/CodeGen/GCMetadata.cpp
+++ b/llvm/lib/CodeGen/GCMetadata.cpp
@@ -66,7 +66,7 @@ GCFunctionAnalysis::run(Function &F, FunctionAnalysisManager &FAM) {
 }
 
 INITIALIZE_PASS(GCModuleInfo, "collector-metadata",
-                "Create Garbage Collector Module Metadata", false, false)
+                "Create Garbage Collector Module Metadata", false, true)
 
 // -----------------------------------------------------------------------------
 
diff --git a/llvm/lib/CodeGen/LiveDebugVariables.cpp b/llvm/lib/CodeGen/LiveDebugVariables.cpp
index 317d3401f000a4..79085e587ebc45 100644
--- a/llvm/lib/CodeGen/LiveDebugVariables.cpp
+++ b/llvm/lib/CodeGen/LiveDebugVariables.cpp
@@ -82,7 +82,7 @@ INITIALIZE_PASS_BEGIN(LiveDebugVariablesWrapperLegacy, DEBUG_TYPE,
 INITIALIZE_PASS_DEPENDENCY(MachineDominatorTreeWrapperPass)
 INITIALIZE_PASS_DEPENDENCY(LiveIntervalsWrapperPass)
 INITIALIZE_PASS_END(LiveDebugVariablesWrapperLegacy, DEBUG_TYPE,
-                    "Debug Variable Analysis", false, false)
+                    "Debug Variable Analysis", false, true)
 
 void LiveDebugVariablesWrapperLegacy::getAnalysisUsage(
     AnalysisUsage &AU) const {
diff --git a/llvm/lib/CodeGen/LiveIntervals.cpp b/llvm/lib/CodeGen/LiveIntervals.cpp
index f9ee6e4563f8d6..f38527a3ce6a31 100644
--- a/llvm/lib/CodeGen/LiveIntervals.cpp
+++ b/llvm/lib/CodeGen/LiveIntervals.cpp
@@ -83,7 +83,7 @@ INITIALIZE_PASS_BEGIN(LiveIntervalsWrapperPass, "liveintervals",
 INITIALIZE_PASS_DEPENDENCY(MachineDominatorTreeWrapperPass)
 INITIALIZE_PASS_DEPENDENCY(SlotIndexesWrapperPass)
 INITIALIZE_PASS_END(LiveIntervalsWrapperPass, "liveintervals",
-                    "Live Interval Analysis", false, false)
+                    "Live Interval Analysis", false, true)
 
 bool LiveIntervalsWrapperPass::runOnMachineFunction(MachineFunction &MF) {
   LIS.Indexes = &getAnalysis<SlotIndexesWrapperPass>().getSI();
diff --git a/llvm/lib/CodeGen/LiveRegMatrix.cpp b/llvm/lib/CodeGen/LiveRegMatrix.cpp
index bc8c59381a40e1..9744c47d5a8510 100644
--- a/llvm/lib/CodeGen/LiveRegMatrix.cpp
+++ b/llvm/lib/CodeGen/LiveRegMatrix.cpp
@@ -41,7 +41,7 @@ INITIALIZE_PASS_BEGIN(LiveRegMatrixWrapperLegacy, "liveregmatrix",
 INITIALIZE_PASS_DEPENDENCY(LiveIntervalsWrapperPass)
 INITIALIZE_PASS_DEPENDENCY(VirtRegMapWrapperLegacy)
 INITIALIZE_PASS_END(LiveRegMatrixWrapperLegacy, "liveregmatrix",
-                    "Live Register Matrix", false, false)
+                    "Live Register Matrix", false, true)
 
 void LiveRegMatrixWrapperLegacy::getAnalysisUsage(AnalysisUsage &AU) const {
   AU.setPreservesAll();
diff --git a/llvm/lib/CodeGen/LiveStacks.cpp b/llvm/lib/CodeGen/LiveStacks.cpp
index 49fe5d6b23452e..e5d2b90578d829 100644
--- a/llvm/lib/CodeGen/LiveStacks.cpp
+++ b/llvm/lib/CodeGen/LiveStacks.cpp
@@ -24,7 +24,7 @@ INITIALIZE_PASS_BEGIN(LiveStacksWrapperLegacy, DEBUG_TYPE,
                       "Live Stack Slot Analysis", false, false)
 INITIALIZE_PASS_DEPENDENCY(SlotIndexesWrapperPass)
 INITIALIZE_PASS_END(LiveStacksWrapperLegacy, DEBUG_TYPE,
-                    "Live Stack Slot Analysis", false, false)
+                    "Live Stack Slot Analysis", false, true)
 
 char &llvm::LiveStacksID = LiveStacksWrapperLegacy::ID;
 
diff --git a/llvm/lib/CodeGen/SlotIndexes.cpp b/llvm/lib/CodeGen/SlotIndexes.cpp
index 1b92a5aa59d18c..8d2832b3fdd56e 100644
--- a/llvm/lib/CodeGen/SlotIndexes.cpp
+++ b/llvm/lib/CodeGen/SlotIndexes.cpp
@@ -45,7 +45,7 @@ SlotIndexes::~SlotIndexes() {
 }
 
 INITIALIZE_PASS(SlotIndexesWrapperPass, DEBUG_TYPE, "Slot index numbering",
-                false, false)
+                false, true)
 
 STATISTIC(NumLocalRenum,  "Number of local renumberings");
 
diff --git a/llvm/lib/CodeGen/VirtRegMap.cpp b/llvm/lib/CodeGen/VirtRegMap.cpp
index 1352102a93d01b..b28c74600e7a29 100644
--- a/llvm/lib/CodeGen/VirtRegMap.cpp
+++ b/llvm/lib/CodeGen/VirtRegMap.cpp
@@ -60,7 +60,7 @@ STATISTIC(NumIdCopies,   "Number of identity moves eliminated after rewriting");
 char VirtRegMapWrapperLegacy::ID = 0;
 
 INITIALIZE_PASS(VirtRegMapWrapperLegacy, "virtregmap", "Virtual Register Map",
-                false, false)
+                false, true)
 
 void VirtRegMap::init(MachineFunction &mf) {
   MRI = &mf.getRegInfo();
diff --git a/llvm/lib/Transforms/Utils/LoopSimplify.cpp b/llvm/lib/Transforms/Utils/LoopSimplify.cpp
index 44fdfe530178a9..d8298646e18d7e 100644
--- a/llvm/lib/Transforms/Utils/LoopSimplify.cpp
+++ b/llvm/lib/Transforms/Utils/LoopSimplify.cpp
@@ -777,8 +777,8 @@ INITIALIZE_PASS_BEGIN(LoopSimplify, "loop-simplify",
 INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
 INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
 INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass)
-INITIALIZE_PASS_END(LoopSimplify, "loop-simplify",
-                "Canonicalize natural loops", false, false)
+INITIALIZE_PASS_END(LoopSimplify, "loop-simplify", "Canonicalize natural loops",
+                    false, true)
 
 // Publicly exposed interface to pass...
 char &llvm::LoopSimplifyID = LoopSimplify::ID;

@optimisan optimisan force-pushed the users/Akshat-Oke/12-05-_codegen_pm_initialize_analyses_with_isanalysis_true branch from 13da564 to 7ee8621 Compare December 5, 2024 10:32
@optimisan optimisan force-pushed the users/Akshat-Oke/12-05-_codegen_newpm_port_livestacks_analysis_to_npm branch from 4493f30 to 765ac4b Compare December 6, 2024 05:17
@optimisan optimisan force-pushed the users/Akshat-Oke/12-05-_codegen_pm_initialize_analyses_with_isanalysis_true branch 2 times, most recently from eeca6f9 to 1efd223 Compare December 6, 2024 09:29
Copy link
Contributor Author

optimisan commented Dec 6, 2024

Merge activity

  • Dec 6, 4:43 AM EST: A user started a stack merge that includes this pull request via Graphite.
  • Dec 6, 4:47 AM EST: Graphite rebased this pull request as part of a merge.
  • Dec 6, 4:50 AM EST: Graphite rebased this pull request as part of a merge.
  • Dec 6, 4:53 AM EST: Graphite rebased this pull request as part of a merge.
  • Dec 6, 4:55 AM EST: A user merged this pull request with Graphite.

@optimisan optimisan force-pushed the users/Akshat-Oke/12-05-_codegen_newpm_port_livestacks_analysis_to_npm branch from 765ac4b to 3da7b77 Compare December 6, 2024 09:44
Base automatically changed from users/Akshat-Oke/12-05-_codegen_newpm_port_livestacks_analysis_to_npm to main December 6, 2024 09:46
@optimisan optimisan force-pushed the users/Akshat-Oke/12-05-_codegen_pm_initialize_analyses_with_isanalysis_true branch 2 times, most recently from 41aff66 to 6cf8e8d Compare December 6, 2024 09:50
Analyses should be marked as analyses else they are prone to be ignored
by the legacy analysis cache mechanism and get scheduled redundantly.
@optimisan optimisan force-pushed the users/Akshat-Oke/12-05-_codegen_pm_initialize_analyses_with_isanalysis_true branch from 6cf8e8d to df18a2e Compare December 6, 2024 09:53
@optimisan optimisan merged commit 49abcd2 into main Dec 6, 2024
5 of 8 checks passed
@optimisan optimisan deleted the users/Akshat-Oke/12-05-_codegen_pm_initialize_analyses_with_isanalysis_true branch December 6, 2024 09:55
@@ -777,8 +777,8 @@ INITIALIZE_PASS_BEGIN(LoopSimplify, "loop-simplify",
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass)
INITIALIZE_PASS_END(LoopSimplify, "loop-simplify",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think loop-simplify is a transformation pass, not an analysis?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes it's not an analysis. I had naively logged a list of passes being addRequired that weren't marked as analyses.
Reverting this line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #121433

optimisan added a commit that referenced this pull request Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants