-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[AA] Move Target Specific AA before BasicAA #125965
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
Changes from all commits
749e4bb
024cb70
0b95b09
4c285ab
9d9a05c
fc8a5e7
63e847d
e5dd092
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -736,28 +736,49 @@ bool AAResultsWrapperPass::runOnFunction(Function &F) { | |
AAR.reset( | ||
new AAResults(getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(F))); | ||
|
||
// Add any target-specific alias analyses that should be run early. | ||
auto *ExtWrapperPass = getAnalysisIfAvailable<ExternalAAWrapperPass>(); | ||
if (ExtWrapperPass && ExtWrapperPass->runEarly() && ExtWrapperPass->CB) { | ||
LLVM_DEBUG(dbgs() << "AAResults register Early ExternalAA: " | ||
<< ExtWrapperPass->getPassName() << "\n"); | ||
ExtWrapperPass->CB(*this, F, *AAR); | ||
} | ||
|
||
// BasicAA is always available for function analyses. Also, we add it first | ||
// so that it can trump TBAA results when it proves MustAlias. | ||
// FIXME: TBAA should have an explicit mode to support this and then we | ||
// should reconsider the ordering here. | ||
if (!DisableBasicAA) | ||
if (!DisableBasicAA) { | ||
LLVM_DEBUG(dbgs() << "AAResults register BasicAA\n"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this new debug output just for the test case? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah. I do not find a good way to test the change in Legacy pass manager, so I have these debug outputs. These outputs are also helpful when I'm making the change for NVPTX AA. Do you have any suggestions for doing the test? |
||
AAR->addAAResult(getAnalysis<BasicAAWrapperPass>().getResult()); | ||
} | ||
|
||
// Populate the results with the currently available AAs. | ||
if (auto *WrapperPass = getAnalysisIfAvailable<ScopedNoAliasAAWrapperPass>()) | ||
if (auto *WrapperPass = | ||
getAnalysisIfAvailable<ScopedNoAliasAAWrapperPass>()) { | ||
LLVM_DEBUG(dbgs() << "AAResults register ScopedNoAliasAA\n"); | ||
AAR->addAAResult(WrapperPass->getResult()); | ||
if (auto *WrapperPass = getAnalysisIfAvailable<TypeBasedAAWrapperPass>()) | ||
} | ||
if (auto *WrapperPass = getAnalysisIfAvailable<TypeBasedAAWrapperPass>()) { | ||
LLVM_DEBUG(dbgs() << "AAResults register TypeBasedAA\n"); | ||
AAR->addAAResult(WrapperPass->getResult()); | ||
if (auto *WrapperPass = getAnalysisIfAvailable<GlobalsAAWrapperPass>()) | ||
} | ||
if (auto *WrapperPass = getAnalysisIfAvailable<GlobalsAAWrapperPass>()) { | ||
LLVM_DEBUG(dbgs() << "AAResults register GlobalsAA\n"); | ||
AAR->addAAResult(WrapperPass->getResult()); | ||
if (auto *WrapperPass = getAnalysisIfAvailable<SCEVAAWrapperPass>()) | ||
} | ||
if (auto *WrapperPass = getAnalysisIfAvailable<SCEVAAWrapperPass>()) { | ||
LLVM_DEBUG(dbgs() << "AAResults register SCEVAA\n"); | ||
AAR->addAAResult(WrapperPass->getResult()); | ||
} | ||
|
||
// If available, run an external AA providing callback over the results as | ||
// well. | ||
if (auto *WrapperPass = getAnalysisIfAvailable<ExternalAAWrapperPass>()) | ||
if (WrapperPass->CB) | ||
WrapperPass->CB(*this, F, *AAR); | ||
if (ExtWrapperPass && !ExtWrapperPass->runEarly() && ExtWrapperPass->CB) { | ||
LLVM_DEBUG(dbgs() << "AAResults register Late ExternalAA: " | ||
<< ExtWrapperPass->getPassName() << "\n"); | ||
ExtWrapperPass->CB(*this, F, *AAR); | ||
} | ||
|
||
// Analyses don't mutate the IR, so return false. | ||
return false; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
; REQUIRES: asserts | ||
; RUN: opt -aa-pipeline=default -passes='require<aa>' -debug-pass-manager -disable-output -S < %s 2>&1 | FileCheck %s | ||
; RUN: llc --debug-only='aa' -o /dev/null %s 2>&1 | FileCheck %s -check-prefix=LEGACY | ||
|
||
; In default AA pipeline, NVPTXAA should run before BasicAA to reduce compile time for NVPTX backend | ||
target triple = "nvptx64-nvidia-cuda" | ||
|
||
; CHECK: Running analysis: NVPTXAA on foo | ||
; CHECK-NEXT: Running analysis: BasicAA on foo | ||
|
||
; LEGACY: AAResults register Early ExternalAA: NVPTX Address space based Alias Analysis Wrapper | ||
; LEGACY-NEXT: AAResults register BasicAA | ||
define void @foo(){ | ||
entry: | ||
ret void | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.