Skip to content

Commit b79889c

Browse files
committed
[opt][NewPM] Add basic-aa in legacy PM compatibility mode
The legacy PM alias analysis pipeline by default includes basic-aa. When running `opt -foo-pass` under the NPM and -disable-basic-aa is not specified, use basic-aa. This decreases the number of check-llvm failures under NPM from 913 to 752. Reviewed By: ychen, asbirlea Differential Revision: https://reviews.llvm.org/D86167
1 parent b37db11 commit b79889c

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

llvm/lib/Analysis/AliasAnalysis.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ using namespace llvm;
5858

5959
/// Allow disabling BasicAA from the AA results. This is particularly useful
6060
/// when testing to isolate a single AA implementation.
61-
static cl::opt<bool> DisableBasicAA("disable-basic-aa", cl::Hidden,
62-
cl::init(false));
61+
cl::opt<bool> DisableBasicAA("disable-basic-aa", cl::Hidden, cl::init(false));
6362

6463
AAResults::AAResults(AAResults &&Arg)
6564
: TLI(Arg.TLI), AAs(std::move(Arg.AAs)), AADeps(std::move(Arg.AADeps)) {

llvm/test/Transforms/SLPVectorizer/X86/limit.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
22
; RUN: opt < %s -slp-vectorizer -S | FileCheck %s
3+
; RUN: opt < %s -slp-vectorizer -enable-new-pm -S | FileCheck %s
34

45
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
56
target triple = "x86_64-unknown-linux-gnu"

llvm/tools/opt/NewPMDriver.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ extern cl::opt<PGOKind> PGOKindFlag;
109109
extern cl::opt<std::string> ProfileFile;
110110
extern cl::opt<CSPGOKind> CSPGOKindFlag;
111111
extern cl::opt<std::string> CSProfileGenFile;
112+
extern cl::opt<bool> DisableBasicAA;
112113

113114
static cl::opt<std::string>
114115
ProfileRemappingFile("profile-remapping-file",
@@ -346,6 +347,17 @@ bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM,
346347
NonAAPasses.push_back(PassName);
347348
}
348349
}
350+
// For compatibility with the legacy PM AA pipeline.
351+
// AAResultsWrapperPass by default provides basic-aa in the legacy PM
352+
// unless -disable-basic-aa is specified.
353+
// TODO: remove this once tests implicitly requiring basic-aa use -passes= and
354+
// -aa-pipeline=basic-aa.
355+
if (!Passes.empty() && !DisableBasicAA) {
356+
if (auto Err = PB.parseAAPipeline(AA, "basic-aa")) {
357+
errs() << Arg0 << ": " << toString(std::move(Err)) << "\n";
358+
return false;
359+
}
360+
}
349361

350362
LoopAnalysisManager LAM(DebugPM);
351363
FunctionAnalysisManager FAM(DebugPM);

0 commit comments

Comments
 (0)