From b79889c2b143890463dca015432da29d3833572d Mon Sep 17 00:00:00 2001 From: Arthur Eubanks Date: Tue, 18 Aug 2020 12:34:19 -0700 Subject: [PATCH] [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 --- llvm/lib/Analysis/AliasAnalysis.cpp | 3 +-- llvm/test/Transforms/SLPVectorizer/X86/limit.ll | 1 + llvm/tools/opt/NewPMDriver.cpp | 12 ++++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp index 2593fc4..318bdea 100644 --- a/llvm/lib/Analysis/AliasAnalysis.cpp +++ b/llvm/lib/Analysis/AliasAnalysis.cpp @@ -58,8 +58,7 @@ using namespace llvm; /// Allow disabling BasicAA from the AA results. This is particularly useful /// when testing to isolate a single AA implementation. -static cl::opt DisableBasicAA("disable-basic-aa", cl::Hidden, - cl::init(false)); +cl::opt DisableBasicAA("disable-basic-aa", cl::Hidden, cl::init(false)); AAResults::AAResults(AAResults &&Arg) : TLI(Arg.TLI), AAs(std::move(Arg.AAs)), AADeps(std::move(Arg.AADeps)) { diff --git a/llvm/test/Transforms/SLPVectorizer/X86/limit.ll b/llvm/test/Transforms/SLPVectorizer/X86/limit.ll index e6d78c0..8c1930c 100644 --- a/llvm/test/Transforms/SLPVectorizer/X86/limit.ll +++ b/llvm/test/Transforms/SLPVectorizer/X86/limit.ll @@ -1,5 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt < %s -slp-vectorizer -S | FileCheck %s +; RUN: opt < %s -slp-vectorizer -enable-new-pm -S | FileCheck %s target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" diff --git a/llvm/tools/opt/NewPMDriver.cpp b/llvm/tools/opt/NewPMDriver.cpp index acaa575..a5c2a1b 100644 --- a/llvm/tools/opt/NewPMDriver.cpp +++ b/llvm/tools/opt/NewPMDriver.cpp @@ -109,6 +109,7 @@ extern cl::opt PGOKindFlag; extern cl::opt ProfileFile; extern cl::opt CSPGOKindFlag; extern cl::opt CSProfileGenFile; +extern cl::opt DisableBasicAA; static cl::opt ProfileRemappingFile("profile-remapping-file", @@ -346,6 +347,17 @@ bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM, NonAAPasses.push_back(PassName); } } + // For compatibility with the legacy PM AA pipeline. + // AAResultsWrapperPass by default provides basic-aa in the legacy PM + // unless -disable-basic-aa is specified. + // TODO: remove this once tests implicitly requiring basic-aa use -passes= and + // -aa-pipeline=basic-aa. + if (!Passes.empty() && !DisableBasicAA) { + if (auto Err = PB.parseAAPipeline(AA, "basic-aa")) { + errs() << Arg0 << ": " << toString(std::move(Err)) << "\n"; + return false; + } + } LoopAnalysisManager LAM(DebugPM); FunctionAnalysisManager FAM(DebugPM); -- 2.7.4