-
Notifications
You must be signed in to change notification settings - Fork 15.2k
LoopSimplify: strip dependency on DA (NFC) #107379
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
@llvm/pr-subscribers-llvm-transforms Author: Ramkumar Ramachandra (artagnon) ChangesFull diff: https://github.com/llvm/llvm-project/pull/107379.diff 1 Files Affected:
diff --git a/llvm/lib/Transforms/Utils/LoopSimplify.cpp b/llvm/lib/Transforms/Utils/LoopSimplify.cpp
index 5e69923fd989dd..7b8be801a652c0 100644
--- a/llvm/lib/Transforms/Utils/LoopSimplify.cpp
+++ b/llvm/lib/Transforms/Utils/LoopSimplify.cpp
@@ -43,18 +43,13 @@
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
-#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/AssumptionCache.h"
-#include "llvm/Analysis/BasicAliasAnalysis.h"
#include "llvm/Analysis/BranchProbabilityInfo.h"
-#include "llvm/Analysis/DependenceAnalysis.h"
-#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/MemorySSA.h"
#include "llvm/Analysis/MemorySSAUpdater.h"
#include "llvm/Analysis/ScalarEvolution.h"
-#include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Dominators.h"
@@ -756,13 +751,8 @@ namespace {
AU.addRequired<LoopInfoWrapperPass>();
AU.addPreserved<LoopInfoWrapperPass>();
- AU.addPreserved<BasicAAWrapperPass>();
- AU.addPreserved<AAResultsWrapperPass>();
- AU.addPreserved<GlobalsAAWrapperPass>();
AU.addPreserved<ScalarEvolutionWrapperPass>();
- AU.addPreserved<SCEVAAWrapperPass>();
AU.addPreservedID(LCSSAID);
- AU.addPreserved<DependenceAnalysisWrapperPass>();
AU.addPreservedID(BreakCriticalEdgesID); // No critical edges added.
AU.addPreserved<BranchProbabilityInfoWrapperPass>();
AU.addPreserved<MemorySSAWrapperPass>();
@@ -849,7 +839,6 @@ PreservedAnalyses LoopSimplifyPass::run(Function &F,
PA.preserve<DominatorTreeAnalysis>();
PA.preserve<LoopAnalysis>();
PA.preserve<ScalarEvolutionAnalysis>();
- PA.preserve<DependenceAnalysis>();
if (MSSAAnalysis)
PA.preserve<MemorySSAAnalysis>();
// BPI maps conditional terminators to probabilities, LoopSimplify can insert
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The legacy pass is still used by the backend, and at least some of these preservations are important.
The CI failures should be fixed now, but how can we be confident that the patch is correct? What is this mysterious preservation? |
Probably mostly in extra compile-time, if later passes now have to recompute otherwise preserved info. It might also impact codegen, e.g. GlobalsAAWrapperPass is stateful IIRC, so not preserving it might throw away previous analysis results without recomputing them. The later could be checked by building a large set of programs and checking if there are binary changes |
d88adb9
to
63dc78e
Compare
Thanks for the explanation! I've now changed this patch to just strip DA (which was my original goal). |
Gentle ping. Is this patch okay now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. It looks like passes that use DependenceAnalysis don't compute it via the pass manager anyway. It's possible that what LoopSimplify is doing could be useful in the future if we have passes using DA via the PM, but for now this looks fine to me.
Since no passes compute DependenceAnalysis via the PassManager, there is no value in preserving it here. Hence, strip the unnecessary dependency on DependenceAnalysis.
Since no passes compute DependenceAnalysis via the PassManager, there is no value in preserving it here. Hence, strip the unnecessary dependency on DependenceAnalysis.