[llvm] r344524 - Revert "[NewPM] teach -passes= to emit meaningful error messages"
Fedor Sergeev via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 15 08:36:08 PDT 2018
Author: fedor.sergeev
Date: Mon Oct 15 08:36:08 2018
New Revision: 344524
URL: http://llvm.org/viewvc/llvm-project?rev=344524&view=rev
Log:
Revert "[NewPM] teach -passes= to emit meaningful error messages"
This reverts r344519 due to failures in pipeline-parsing test.
Modified:
llvm/trunk/include/llvm/Passes/PassBuilder.h
llvm/trunk/lib/LTO/LTOBackend.cpp
llvm/trunk/lib/Passes/PassBuilder.cpp
llvm/trunk/test/Other/pass-pipeline-parsing.ll
llvm/trunk/test/tools/llvm-lto2/X86/pipeline.ll
llvm/trunk/test/tools/llvm-opt-fuzzer/command-line.ll
llvm/trunk/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp
llvm/trunk/tools/opt/NewPMDriver.cpp
llvm/trunk/unittests/IR/CMakeLists.txt
llvm/trunk/unittests/IR/PassBuilderCallbacksTest.cpp
llvm/trunk/unittests/Passes/CMakeLists.txt
llvm/trunk/unittests/Passes/PluginsTest.cpp
Modified: llvm/trunk/include/llvm/Passes/PassBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Passes/PassBuilder.h?rev=344524&r1=344523&r2=344524&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Passes/PassBuilder.h (original)
+++ llvm/trunk/include/llvm/Passes/PassBuilder.h Mon Oct 15 08:36:08 2018
@@ -19,7 +19,6 @@
#include "llvm/ADT/Optional.h"
#include "llvm/Analysis/CGSCCPassManager.h"
#include "llvm/IR/PassManager.h"
-#include "llvm/Support/Error.h"
#include "llvm/Transforms/Instrumentation.h"
#include "llvm/Transforms/Scalar/LoopPassManager.h"
#include <vector>
@@ -385,9 +384,8 @@ public:
/// If the sequence of passes aren't all the exact same kind of pass, it will
/// be an error. You cannot mix different levels implicitly, you must
/// explicitly form a pass manager in which to nest passes.
- Error parsePassPipeline(ModulePassManager &MPM, StringRef PipelineText,
- bool VerifyEachPass = true,
- bool DebugLogging = false);
+ bool parsePassPipeline(ModulePassManager &MPM, StringRef PipelineText,
+ bool VerifyEachPass = true, bool DebugLogging = false);
/// {{@ Parse a textual pass pipeline description into a specific PassManager
///
@@ -396,15 +394,12 @@ public:
/// this is the valid pipeline text:
///
/// function(lpass)
- Error parsePassPipeline(CGSCCPassManager &CGPM, StringRef PipelineText,
- bool VerifyEachPass = true,
- bool DebugLogging = false);
- Error parsePassPipeline(FunctionPassManager &FPM, StringRef PipelineText,
- bool VerifyEachPass = true,
- bool DebugLogging = false);
- Error parsePassPipeline(LoopPassManager &LPM, StringRef PipelineText,
- bool VerifyEachPass = true,
- bool DebugLogging = false);
+ bool parsePassPipeline(CGSCCPassManager &CGPM, StringRef PipelineText,
+ bool VerifyEachPass = true, bool DebugLogging = false);
+ bool parsePassPipeline(FunctionPassManager &FPM, StringRef PipelineText,
+ bool VerifyEachPass = true, bool DebugLogging = false);
+ bool parsePassPipeline(LoopPassManager &LPM, StringRef PipelineText,
+ bool VerifyEachPass = true, bool DebugLogging = false);
/// @}}
/// Parse a textual alias analysis pipeline into the provided AA manager.
@@ -422,7 +417,7 @@ public:
/// Returns false if the text cannot be parsed cleanly. The specific state of
/// the \p AA manager is unspecified if such an error is encountered and this
/// returns false.
- Error parseAAPipeline(AAManager &AA, StringRef PipelineText);
+ bool parseAAPipeline(AAManager &AA, StringRef PipelineText);
/// Register a callback for a default optimizer pipeline extension
/// point
@@ -570,28 +565,28 @@ private:
static Optional<std::vector<PipelineElement>>
parsePipelineText(StringRef Text);
- Error parseModulePass(ModulePassManager &MPM, const PipelineElement &E,
- bool VerifyEachPass, bool DebugLogging);
- Error parseCGSCCPass(CGSCCPassManager &CGPM, const PipelineElement &E,
+ bool parseModulePass(ModulePassManager &MPM, const PipelineElement &E,
bool VerifyEachPass, bool DebugLogging);
- Error parseFunctionPass(FunctionPassManager &FPM, const PipelineElement &E,
- bool VerifyEachPass, bool DebugLogging);
- Error parseLoopPass(LoopPassManager &LPM, const PipelineElement &E,
+ bool parseCGSCCPass(CGSCCPassManager &CGPM, const PipelineElement &E,
bool VerifyEachPass, bool DebugLogging);
+ bool parseFunctionPass(FunctionPassManager &FPM, const PipelineElement &E,
+ bool VerifyEachPass, bool DebugLogging);
+ bool parseLoopPass(LoopPassManager &LPM, const PipelineElement &E,
+ bool VerifyEachPass, bool DebugLogging);
bool parseAAPassName(AAManager &AA, StringRef Name);
- Error parseLoopPassPipeline(LoopPassManager &LPM,
+ bool parseLoopPassPipeline(LoopPassManager &LPM,
+ ArrayRef<PipelineElement> Pipeline,
+ bool VerifyEachPass, bool DebugLogging);
+ bool parseFunctionPassPipeline(FunctionPassManager &FPM,
+ ArrayRef<PipelineElement> Pipeline,
+ bool VerifyEachPass, bool DebugLogging);
+ bool parseCGSCCPassPipeline(CGSCCPassManager &CGPM,
ArrayRef<PipelineElement> Pipeline,
bool VerifyEachPass, bool DebugLogging);
- Error parseFunctionPassPipeline(FunctionPassManager &FPM,
- ArrayRef<PipelineElement> Pipeline,
- bool VerifyEachPass, bool DebugLogging);
- Error parseCGSCCPassPipeline(CGSCCPassManager &CGPM,
+ bool parseModulePassPipeline(ModulePassManager &MPM,
ArrayRef<PipelineElement> Pipeline,
bool VerifyEachPass, bool DebugLogging);
- Error parseModulePassPipeline(ModulePassManager &MPM,
- ArrayRef<PipelineElement> Pipeline,
- bool VerifyEachPass, bool DebugLogging);
void addPGOInstrPasses(ModulePassManager &MPM, bool DebugLogging,
OptimizationLevel Level, bool RunProfileGen,
Modified: llvm/trunk/lib/LTO/LTOBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOBackend.cpp?rev=344524&r1=344523&r2=344524&view=diff
==============================================================================
--- llvm/trunk/lib/LTO/LTOBackend.cpp (original)
+++ llvm/trunk/lib/LTO/LTOBackend.cpp Mon Oct 15 08:36:08 2018
@@ -162,7 +162,7 @@ static void runNewPMPasses(Config &Conf,
AAManager AA;
// Parse a custom AA pipeline if asked to.
- if (auto Err = PB.parseAAPipeline(AA, "default"))
+ if (!PB.parseAAPipeline(AA, "default"))
report_fatal_error("Error parsing default AA pipeline");
LoopAnalysisManager LAM(Conf.DebugPassManager);
@@ -221,9 +221,9 @@ static void runNewPMCustomPasses(Module
// Parse a custom AA pipeline if asked to.
if (!AAPipelineDesc.empty())
- if (auto Err = PB.parseAAPipeline(AA, AAPipelineDesc))
- report_fatal_error("unable to parse AA pipeline description '" +
- AAPipelineDesc + "': " + toString(std::move(Err)));
+ if (!PB.parseAAPipeline(AA, AAPipelineDesc))
+ report_fatal_error("unable to parse AA pipeline description: " +
+ AAPipelineDesc);
LoopAnalysisManager LAM;
FunctionAnalysisManager FAM;
@@ -246,9 +246,9 @@ static void runNewPMCustomPasses(Module
MPM.addPass(VerifierPass());
// Now, add all the passes we've been requested to.
- if (auto Err = PB.parsePassPipeline(MPM, PipelineDesc))
- report_fatal_error("unable to parse pass pipeline description '" +
- PipelineDesc + "': " + toString(std::move(Err)));
+ if (!PB.parsePassPipeline(MPM, PipelineDesc))
+ report_fatal_error("unable to parse pass pipeline description: " +
+ PipelineDesc);
if (!DisableVerify)
MPM.addPass(VerifierPass());
Modified: llvm/trunk/lib/Passes/PassBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Passes/PassBuilder.cpp?rev=344524&r1=344523&r2=344524&view=diff
==============================================================================
--- llvm/trunk/lib/Passes/PassBuilder.cpp (original)
+++ llvm/trunk/lib/Passes/PassBuilder.cpp Mon Oct 15 08:36:08 2018
@@ -58,7 +58,6 @@
#include "llvm/IR/PassManager.h"
#include "llvm/IR/Verifier.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/Regex.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h"
@@ -1403,9 +1402,9 @@ PassBuilder::parsePipelineText(StringRef
return {std::move(ResultPipeline)};
}
-Error PassBuilder::parseModulePass(ModulePassManager &MPM,
- const PipelineElement &E,
- bool VerifyEachPass, bool DebugLogging) {
+bool PassBuilder::parseModulePass(ModulePassManager &MPM,
+ const PipelineElement &E, bool VerifyEachPass,
+ bool DebugLogging) {
auto &Name = E.Name;
auto &InnerPipeline = E.InnerPipeline;
@@ -1413,56 +1412,50 @@ Error PassBuilder::parseModulePass(Modul
if (!InnerPipeline.empty()) {
if (Name == "module") {
ModulePassManager NestedMPM(DebugLogging);
- if (auto Err = parseModulePassPipeline(NestedMPM, InnerPipeline,
- VerifyEachPass, DebugLogging))
- return Err;
+ if (!parseModulePassPipeline(NestedMPM, InnerPipeline, VerifyEachPass,
+ DebugLogging))
+ return false;
MPM.addPass(std::move(NestedMPM));
- return Error::success();
+ return true;
}
if (Name == "cgscc") {
CGSCCPassManager CGPM(DebugLogging);
- if (auto Err = parseCGSCCPassPipeline(CGPM, InnerPipeline, VerifyEachPass,
- DebugLogging))
- return Err;
+ if (!parseCGSCCPassPipeline(CGPM, InnerPipeline, VerifyEachPass,
+ DebugLogging))
+ return false;
MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(std::move(CGPM)));
- return Error::success();
+ return true;
}
if (Name == "function") {
FunctionPassManager FPM(DebugLogging);
- if (auto Err = parseFunctionPassPipeline(FPM, InnerPipeline,
- VerifyEachPass, DebugLogging))
- return Err;
+ if (!parseFunctionPassPipeline(FPM, InnerPipeline, VerifyEachPass,
+ DebugLogging))
+ return false;
MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
- return Error::success();
+ return true;
}
if (auto Count = parseRepeatPassName(Name)) {
ModulePassManager NestedMPM(DebugLogging);
- if (auto Err = parseModulePassPipeline(NestedMPM, InnerPipeline,
- VerifyEachPass, DebugLogging))
- return Err;
+ if (!parseModulePassPipeline(NestedMPM, InnerPipeline, VerifyEachPass,
+ DebugLogging))
+ return false;
MPM.addPass(createRepeatedPass(*Count, std::move(NestedMPM)));
- return Error::success();
+ return true;
}
for (auto &C : ModulePipelineParsingCallbacks)
if (C(Name, MPM, InnerPipeline))
- return Error::success();
+ return true;
// Normal passes can't have pipelines.
- return make_error<StringError>(
- formatv("invalid use of '{0}' pass as module pipeline", Name).str(),
- inconvertibleErrorCode());
- ;
+ return false;
}
// Manually handle aliases for pre-configured pipeline fragments.
if (startsWithDefaultPipelineAliasPrefix(Name)) {
SmallVector<StringRef, 3> Matches;
if (!DefaultAliasRegex.match(Name, &Matches))
- return make_error<StringError>(
- formatv("unknown default pipeline alias '{0}'", Name).str(),
- inconvertibleErrorCode());
-
+ return false;
assert(Matches.size() == 3 && "Must capture two matched strings!");
OptimizationLevel L = StringSwitch<OptimizationLevel>(Matches[2])
@@ -1474,7 +1467,7 @@ Error PassBuilder::parseModulePass(Modul
.Case("Oz", Oz);
if (L == O0)
// At O0 we do nothing at all!
- return Error::success();
+ return true;
if (Matches[1] == "default") {
MPM.addPass(buildPerModuleDefaultPipeline(L, DebugLogging));
@@ -1488,40 +1481,38 @@ Error PassBuilder::parseModulePass(Modul
assert(Matches[1] == "lto" && "Not one of the matched options!");
MPM.addPass(buildLTODefaultPipeline(L, DebugLogging, nullptr));
}
- return Error::success();
+ return true;
}
// Finally expand the basic registered passes from the .inc file.
#define MODULE_PASS(NAME, CREATE_PASS) \
if (Name == NAME) { \
MPM.addPass(CREATE_PASS); \
- return Error::success(); \
+ return true; \
}
#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
if (Name == "require<" NAME ">") { \
MPM.addPass( \
RequireAnalysisPass< \
std::remove_reference<decltype(CREATE_PASS)>::type, Module>()); \
- return Error::success(); \
+ return true; \
} \
if (Name == "invalidate<" NAME ">") { \
MPM.addPass(InvalidateAnalysisPass< \
std::remove_reference<decltype(CREATE_PASS)>::type>()); \
- return Error::success(); \
+ return true; \
}
#include "PassRegistry.def"
for (auto &C : ModulePipelineParsingCallbacks)
if (C(Name, MPM, InnerPipeline))
- return Error::success();
- return make_error<StringError>(
- formatv("unknown module pass '{0}'", Name).str(),
- inconvertibleErrorCode());
+ return true;
+ return false;
}
-Error PassBuilder::parseCGSCCPass(CGSCCPassManager &CGPM,
- const PipelineElement &E, bool VerifyEachPass,
- bool DebugLogging) {
+bool PassBuilder::parseCGSCCPass(CGSCCPassManager &CGPM,
+ const PipelineElement &E, bool VerifyEachPass,
+ bool DebugLogging) {
auto &Name = E.Name;
auto &InnerPipeline = E.InnerPipeline;
@@ -1529,55 +1520,53 @@ Error PassBuilder::parseCGSCCPass(CGSCCP
if (!InnerPipeline.empty()) {
if (Name == "cgscc") {
CGSCCPassManager NestedCGPM(DebugLogging);
- if (auto Err = parseCGSCCPassPipeline(NestedCGPM, InnerPipeline,
- VerifyEachPass, DebugLogging))
- return Err;
+ if (!parseCGSCCPassPipeline(NestedCGPM, InnerPipeline, VerifyEachPass,
+ DebugLogging))
+ return false;
// Add the nested pass manager with the appropriate adaptor.
CGPM.addPass(std::move(NestedCGPM));
- return Error::success();
+ return true;
}
if (Name == "function") {
FunctionPassManager FPM(DebugLogging);
- if (auto Err = parseFunctionPassPipeline(FPM, InnerPipeline,
- VerifyEachPass, DebugLogging))
- return Err;
+ if (!parseFunctionPassPipeline(FPM, InnerPipeline, VerifyEachPass,
+ DebugLogging))
+ return false;
// Add the nested pass manager with the appropriate adaptor.
CGPM.addPass(createCGSCCToFunctionPassAdaptor(std::move(FPM)));
- return Error::success();
+ return true;
}
if (auto Count = parseRepeatPassName(Name)) {
CGSCCPassManager NestedCGPM(DebugLogging);
- if (auto Err = parseCGSCCPassPipeline(NestedCGPM, InnerPipeline,
- VerifyEachPass, DebugLogging))
- return Err;
+ if (!parseCGSCCPassPipeline(NestedCGPM, InnerPipeline, VerifyEachPass,
+ DebugLogging))
+ return false;
CGPM.addPass(createRepeatedPass(*Count, std::move(NestedCGPM)));
- return Error::success();
+ return true;
}
if (auto MaxRepetitions = parseDevirtPassName(Name)) {
CGSCCPassManager NestedCGPM(DebugLogging);
- if (auto Err = parseCGSCCPassPipeline(NestedCGPM, InnerPipeline,
- VerifyEachPass, DebugLogging))
- return Err;
+ if (!parseCGSCCPassPipeline(NestedCGPM, InnerPipeline, VerifyEachPass,
+ DebugLogging))
+ return false;
CGPM.addPass(
createDevirtSCCRepeatedPass(std::move(NestedCGPM), *MaxRepetitions));
- return Error::success();
+ return true;
}
for (auto &C : CGSCCPipelineParsingCallbacks)
if (C(Name, CGPM, InnerPipeline))
- return Error::success();
+ return true;
// Normal passes can't have pipelines.
- return make_error<StringError>(
- formatv("invalid use of '{0}' pass as cgscc pipeline", Name).str(),
- inconvertibleErrorCode());
+ return false;
}
// Now expand the basic registered passes from the .inc file.
#define CGSCC_PASS(NAME, CREATE_PASS) \
if (Name == NAME) { \
CGPM.addPass(CREATE_PASS); \
- return Error::success(); \
+ return true; \
}
#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
if (Name == "require<" NAME ">") { \
@@ -1585,26 +1574,24 @@ Error PassBuilder::parseCGSCCPass(CGSCCP
std::remove_reference<decltype(CREATE_PASS)>::type, \
LazyCallGraph::SCC, CGSCCAnalysisManager, LazyCallGraph &, \
CGSCCUpdateResult &>()); \
- return Error::success(); \
+ return true; \
} \
if (Name == "invalidate<" NAME ">") { \
CGPM.addPass(InvalidateAnalysisPass< \
std::remove_reference<decltype(CREATE_PASS)>::type>()); \
- return Error::success(); \
+ return true; \
}
#include "PassRegistry.def"
for (auto &C : CGSCCPipelineParsingCallbacks)
if (C(Name, CGPM, InnerPipeline))
- return Error::success();
- return make_error<StringError>(
- formatv("unknown cgscc pass '{0}'", Name).str(),
- inconvertibleErrorCode());
+ return true;
+ return false;
}
-Error PassBuilder::parseFunctionPass(FunctionPassManager &FPM,
- const PipelineElement &E,
- bool VerifyEachPass, bool DebugLogging) {
+bool PassBuilder::parseFunctionPass(FunctionPassManager &FPM,
+ const PipelineElement &E,
+ bool VerifyEachPass, bool DebugLogging) {
auto &Name = E.Name;
auto &InnerPipeline = E.InnerPipeline;
@@ -1612,72 +1599,68 @@ Error PassBuilder::parseFunctionPass(Fun
if (!InnerPipeline.empty()) {
if (Name == "function") {
FunctionPassManager NestedFPM(DebugLogging);
- if (auto Err = parseFunctionPassPipeline(NestedFPM, InnerPipeline,
- VerifyEachPass, DebugLogging))
- return Err;
+ if (!parseFunctionPassPipeline(NestedFPM, InnerPipeline, VerifyEachPass,
+ DebugLogging))
+ return false;
// Add the nested pass manager with the appropriate adaptor.
FPM.addPass(std::move(NestedFPM));
- return Error::success();
+ return true;
}
if (Name == "loop") {
LoopPassManager LPM(DebugLogging);
- if (auto Err = parseLoopPassPipeline(LPM, InnerPipeline, VerifyEachPass,
- DebugLogging))
- return Err;
+ if (!parseLoopPassPipeline(LPM, InnerPipeline, VerifyEachPass,
+ DebugLogging))
+ return false;
// Add the nested pass manager with the appropriate adaptor.
FPM.addPass(
createFunctionToLoopPassAdaptor(std::move(LPM), DebugLogging));
- return Error::success();
+ return true;
}
if (auto Count = parseRepeatPassName(Name)) {
FunctionPassManager NestedFPM(DebugLogging);
- if (auto Err = parseFunctionPassPipeline(NestedFPM, InnerPipeline,
- VerifyEachPass, DebugLogging))
- return Err;
+ if (!parseFunctionPassPipeline(NestedFPM, InnerPipeline, VerifyEachPass,
+ DebugLogging))
+ return false;
FPM.addPass(createRepeatedPass(*Count, std::move(NestedFPM)));
- return Error::success();
+ return true;
}
for (auto &C : FunctionPipelineParsingCallbacks)
if (C(Name, FPM, InnerPipeline))
- return Error::success();
+ return true;
// Normal passes can't have pipelines.
- return make_error<StringError>(
- formatv("invalid use of '{0}' pass as function pipeline", Name).str(),
- inconvertibleErrorCode());
+ return false;
}
// Now expand the basic registered passes from the .inc file.
#define FUNCTION_PASS(NAME, CREATE_PASS) \
if (Name == NAME) { \
FPM.addPass(CREATE_PASS); \
- return Error::success(); \
+ return true; \
}
#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
if (Name == "require<" NAME ">") { \
FPM.addPass( \
RequireAnalysisPass< \
std::remove_reference<decltype(CREATE_PASS)>::type, Function>()); \
- return Error::success(); \
+ return true; \
} \
if (Name == "invalidate<" NAME ">") { \
FPM.addPass(InvalidateAnalysisPass< \
std::remove_reference<decltype(CREATE_PASS)>::type>()); \
- return Error::success(); \
+ return true; \
}
#include "PassRegistry.def"
for (auto &C : FunctionPipelineParsingCallbacks)
if (C(Name, FPM, InnerPipeline))
- return Error::success();
- return make_error<StringError>(
- formatv("unknown function pass '{0}'", Name).str(),
- inconvertibleErrorCode());
+ return true;
+ return false;
}
-Error PassBuilder::parseLoopPass(LoopPassManager &LPM, const PipelineElement &E,
- bool VerifyEachPass, bool DebugLogging) {
+bool PassBuilder::parseLoopPass(LoopPassManager &LPM, const PipelineElement &E,
+ bool VerifyEachPass, bool DebugLogging) {
StringRef Name = E.Name;
auto &InnerPipeline = E.InnerPipeline;
@@ -1685,37 +1668,35 @@ Error PassBuilder::parseLoopPass(LoopPas
if (!InnerPipeline.empty()) {
if (Name == "loop") {
LoopPassManager NestedLPM(DebugLogging);
- if (auto Err = parseLoopPassPipeline(NestedLPM, InnerPipeline,
- VerifyEachPass, DebugLogging))
- return Err;
+ if (!parseLoopPassPipeline(NestedLPM, InnerPipeline, VerifyEachPass,
+ DebugLogging))
+ return false;
// Add the nested pass manager with the appropriate adaptor.
LPM.addPass(std::move(NestedLPM));
- return Error::success();
+ return true;
}
if (auto Count = parseRepeatPassName(Name)) {
LoopPassManager NestedLPM(DebugLogging);
- if (auto Err = parseLoopPassPipeline(NestedLPM, InnerPipeline,
- VerifyEachPass, DebugLogging))
- return Err;
+ if (!parseLoopPassPipeline(NestedLPM, InnerPipeline, VerifyEachPass,
+ DebugLogging))
+ return false;
LPM.addPass(createRepeatedPass(*Count, std::move(NestedLPM)));
- return Error::success();
+ return true;
}
for (auto &C : LoopPipelineParsingCallbacks)
if (C(Name, LPM, InnerPipeline))
- return Error::success();
+ return true;
// Normal passes can't have pipelines.
- return make_error<StringError>(
- formatv("invalid use of '{0}' pass as loop pipeline", Name).str(),
- inconvertibleErrorCode());
+ return false;
}
// Now expand the basic registered passes from the .inc file.
#define LOOP_PASS(NAME, CREATE_PASS) \
if (Name == NAME) { \
LPM.addPass(CREATE_PASS); \
- return Error::success(); \
+ return true; \
}
#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
if (Name == "require<" NAME ">") { \
@@ -1723,20 +1704,19 @@ Error PassBuilder::parseLoopPass(LoopPas
std::remove_reference<decltype(CREATE_PASS)>::type, Loop, \
LoopAnalysisManager, LoopStandardAnalysisResults &, \
LPMUpdater &>()); \
- return Error::success(); \
+ return true; \
} \
if (Name == "invalidate<" NAME ">") { \
LPM.addPass(InvalidateAnalysisPass< \
std::remove_reference<decltype(CREATE_PASS)>::type>()); \
- return Error::success(); \
+ return true; \
}
#include "PassRegistry.def"
for (auto &C : LoopPipelineParsingCallbacks)
if (C(Name, LPM, InnerPipeline))
- return Error::success();
- return make_error<StringError>(formatv("unknown loop pass '{0}'", Name).str(),
- inconvertibleErrorCode());
+ return true;
+ return false;
}
bool PassBuilder::parseAAPassName(AAManager &AA, StringRef Name) {
@@ -1760,42 +1740,41 @@ bool PassBuilder::parseAAPassName(AAMana
return false;
}
-Error PassBuilder::parseLoopPassPipeline(LoopPassManager &LPM,
- ArrayRef<PipelineElement> Pipeline,
- bool VerifyEachPass,
- bool DebugLogging) {
+bool PassBuilder::parseLoopPassPipeline(LoopPassManager &LPM,
+ ArrayRef<PipelineElement> Pipeline,
+ bool VerifyEachPass,
+ bool DebugLogging) {
for (const auto &Element : Pipeline) {
- if (auto Err = parseLoopPass(LPM, Element, VerifyEachPass, DebugLogging))
- return Err;
+ if (!parseLoopPass(LPM, Element, VerifyEachPass, DebugLogging))
+ return false;
// FIXME: No verifier support for Loop passes!
}
- return Error::success();
+ return true;
}
-Error PassBuilder::parseFunctionPassPipeline(FunctionPassManager &FPM,
- ArrayRef<PipelineElement> Pipeline,
- bool VerifyEachPass,
- bool DebugLogging) {
+bool PassBuilder::parseFunctionPassPipeline(FunctionPassManager &FPM,
+ ArrayRef<PipelineElement> Pipeline,
+ bool VerifyEachPass,
+ bool DebugLogging) {
for (const auto &Element : Pipeline) {
- if (auto Err =
- parseFunctionPass(FPM, Element, VerifyEachPass, DebugLogging))
- return Err;
+ if (!parseFunctionPass(FPM, Element, VerifyEachPass, DebugLogging))
+ return false;
if (VerifyEachPass)
FPM.addPass(VerifierPass());
}
- return Error::success();
+ return true;
}
-Error PassBuilder::parseCGSCCPassPipeline(CGSCCPassManager &CGPM,
- ArrayRef<PipelineElement> Pipeline,
- bool VerifyEachPass,
- bool DebugLogging) {
+bool PassBuilder::parseCGSCCPassPipeline(CGSCCPassManager &CGPM,
+ ArrayRef<PipelineElement> Pipeline,
+ bool VerifyEachPass,
+ bool DebugLogging) {
for (const auto &Element : Pipeline) {
- if (auto Err = parseCGSCCPass(CGPM, Element, VerifyEachPass, DebugLogging))
- return Err;
+ if (!parseCGSCCPass(CGPM, Element, VerifyEachPass, DebugLogging))
+ return false;
// FIXME: No verifier support for CGSCC passes!
}
- return Error::success();
+ return true;
}
void PassBuilder::crossRegisterProxies(LoopAnalysisManager &LAM,
@@ -1811,30 +1790,28 @@ void PassBuilder::crossRegisterProxies(L
LAM.registerPass([&] { return FunctionAnalysisManagerLoopProxy(FAM); });
}
-Error PassBuilder::parseModulePassPipeline(ModulePassManager &MPM,
- ArrayRef<PipelineElement> Pipeline,
- bool VerifyEachPass,
- bool DebugLogging) {
+bool PassBuilder::parseModulePassPipeline(ModulePassManager &MPM,
+ ArrayRef<PipelineElement> Pipeline,
+ bool VerifyEachPass,
+ bool DebugLogging) {
for (const auto &Element : Pipeline) {
- if (auto Err = parseModulePass(MPM, Element, VerifyEachPass, DebugLogging))
- return Err;
+ if (!parseModulePass(MPM, Element, VerifyEachPass, DebugLogging))
+ return false;
if (VerifyEachPass)
MPM.addPass(VerifierPass());
}
- return Error::success();
+ return true;
}
// Primary pass pipeline description parsing routine for a \c ModulePassManager
// FIXME: Should this routine accept a TargetMachine or require the caller to
// pre-populate the analysis managers with target-specific stuff?
-Error PassBuilder::parsePassPipeline(ModulePassManager &MPM,
- StringRef PipelineText,
- bool VerifyEachPass, bool DebugLogging) {
+bool PassBuilder::parsePassPipeline(ModulePassManager &MPM,
+ StringRef PipelineText, bool VerifyEachPass,
+ bool DebugLogging) {
auto Pipeline = parsePipelineText(PipelineText);
if (!Pipeline || Pipeline->empty())
- return make_error<StringError>(
- formatv("invalid pipeline '{0}'", PipelineText).str(),
- inconvertibleErrorCode());
+ return false;
// If the first name isn't at the module layer, wrap the pipeline up
// automatically.
@@ -1851,106 +1828,73 @@ Error PassBuilder::parsePassPipeline(Mod
} else {
for (auto &C : TopLevelPipelineParsingCallbacks)
if (C(MPM, *Pipeline, VerifyEachPass, DebugLogging))
- return Error::success();
+ return true;
- // Unknown pass or pipeline name!
- auto &InnerPipeline = Pipeline->front().InnerPipeline;
- return make_error<StringError>(
- formatv("unknown {0} name '{1}'",
- (InnerPipeline.empty() ? "pass" : "pipeline"), FirstName)
- .str(),
- inconvertibleErrorCode());
+ // Unknown pass name!
+ return false;
}
}
- if (auto Err =
- parseModulePassPipeline(MPM, *Pipeline, VerifyEachPass, DebugLogging))
- return Err;
- return Error::success();
+ return parseModulePassPipeline(MPM, *Pipeline, VerifyEachPass, DebugLogging);
}
// Primary pass pipeline description parsing routine for a \c CGSCCPassManager
-Error PassBuilder::parsePassPipeline(CGSCCPassManager &CGPM,
- StringRef PipelineText,
- bool VerifyEachPass, bool DebugLogging) {
+bool PassBuilder::parsePassPipeline(CGSCCPassManager &CGPM,
+ StringRef PipelineText, bool VerifyEachPass,
+ bool DebugLogging) {
auto Pipeline = parsePipelineText(PipelineText);
if (!Pipeline || Pipeline->empty())
- return make_error<StringError>(
- formatv("invalid pipeline '{0}'", PipelineText).str(),
- inconvertibleErrorCode());
+ return false;
StringRef FirstName = Pipeline->front().Name;
if (!isCGSCCPassName(FirstName, CGSCCPipelineParsingCallbacks))
- return make_error<StringError>(
- formatv("unknown cgscc pass '{0}' in pipeline '{1}'", FirstName,
- PipelineText)
- .str(),
- inconvertibleErrorCode());
-
- if (auto Err =
- parseCGSCCPassPipeline(CGPM, *Pipeline, VerifyEachPass, DebugLogging))
- return Err;
- return Error::success();
+ return false;
+
+ return parseCGSCCPassPipeline(CGPM, *Pipeline, VerifyEachPass, DebugLogging);
}
// Primary pass pipeline description parsing routine for a \c
// FunctionPassManager
-Error PassBuilder::parsePassPipeline(FunctionPassManager &FPM,
- StringRef PipelineText,
- bool VerifyEachPass, bool DebugLogging) {
+bool PassBuilder::parsePassPipeline(FunctionPassManager &FPM,
+ StringRef PipelineText, bool VerifyEachPass,
+ bool DebugLogging) {
auto Pipeline = parsePipelineText(PipelineText);
if (!Pipeline || Pipeline->empty())
- return make_error<StringError>(
- formatv("invalid pipeline '{0}'", PipelineText).str(),
- inconvertibleErrorCode());
+ return false;
StringRef FirstName = Pipeline->front().Name;
if (!isFunctionPassName(FirstName, FunctionPipelineParsingCallbacks))
- return make_error<StringError>(
- formatv("unknown function pass '{0}' in pipeline '{1}'", FirstName,
- PipelineText)
- .str(),
- inconvertibleErrorCode());
-
- if (auto Err = parseFunctionPassPipeline(FPM, *Pipeline, VerifyEachPass,
- DebugLogging))
- return Err;
- return Error::success();
+ return false;
+
+ return parseFunctionPassPipeline(FPM, *Pipeline, VerifyEachPass,
+ DebugLogging);
}
// Primary pass pipeline description parsing routine for a \c LoopPassManager
-Error PassBuilder::parsePassPipeline(LoopPassManager &CGPM,
- StringRef PipelineText,
- bool VerifyEachPass, bool DebugLogging) {
+bool PassBuilder::parsePassPipeline(LoopPassManager &CGPM,
+ StringRef PipelineText, bool VerifyEachPass,
+ bool DebugLogging) {
auto Pipeline = parsePipelineText(PipelineText);
if (!Pipeline || Pipeline->empty())
- return make_error<StringError>(
- formatv("invalid pipeline '{0}'", PipelineText).str(),
- inconvertibleErrorCode());
-
- if (auto Err =
- parseLoopPassPipeline(CGPM, *Pipeline, VerifyEachPass, DebugLogging))
- return Err;
+ return false;
- return Error::success();
+ return parseLoopPassPipeline(CGPM, *Pipeline, VerifyEachPass, DebugLogging);
}
-Error PassBuilder::parseAAPipeline(AAManager &AA, StringRef PipelineText) {
+bool PassBuilder::parseAAPipeline(AAManager &AA, StringRef PipelineText) {
// If the pipeline just consists of the word 'default' just replace the AA
// manager with our default one.
if (PipelineText == "default") {
AA = buildDefaultAAPipeline();
- return Error::success();
+ return true;
}
while (!PipelineText.empty()) {
StringRef Name;
std::tie(Name, PipelineText) = PipelineText.split(',');
if (!parseAAPassName(AA, Name))
- return make_error<StringError>(
- formatv("unknown alias analysis name '{0}'", Name).str(),
- inconvertibleErrorCode());
+ return false;
}
- return Error::success();
+ return true;
}
Modified: llvm/trunk/test/Other/pass-pipeline-parsing.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/pass-pipeline-parsing.ll?rev=344524&r1=344523&r2=344524&view=diff
==============================================================================
--- llvm/trunk/test/Other/pass-pipeline-parsing.ll (original)
+++ llvm/trunk/test/Other/pass-pipeline-parsing.ll Mon Oct 15 08:36:08 2018
@@ -54,52 +54,52 @@
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='no-op-module)' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-UNBALANCED1
-; CHECK-UNBALANCED1: invalid pipeline 'no-op-module)'
+; CHECK-UNBALANCED1: unable to parse pass pipeline description
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='module(no-op-module))' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-UNBALANCED2
-; CHECK-UNBALANCED2: invalid pipeline 'module(no-op-module))'
+; CHECK-UNBALANCED2: unable to parse pass pipeline description
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='module(no-op-module' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-UNBALANCED3
-; CHECK-UNBALANCED3: invalid pipeline 'module(no-op-module'
+; CHECK-UNBALANCED3: unable to parse pass pipeline description
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='no-op-function)' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-UNBALANCED4
-; CHECK-UNBALANCED4: invalid pipeline 'no-op-function)'
+; CHECK-UNBALANCED4: unable to parse pass pipeline description
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='function(no-op-function))' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-UNBALANCED5
-; CHECK-UNBALANCED5: invalid pipeline 'function(no-op-function))'
+; CHECK-UNBALANCED5: unable to parse pass pipeline description
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='function(function(no-op-function)))' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-UNBALANCED6
-; CHECK-UNBALANCED6: invalid pipeline 'function(function(no-op-function)))'
+; CHECK-UNBALANCED6: unable to parse pass pipeline description
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='function(no-op-function' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-UNBALANCED7
-; CHECK-UNBALANCED7: invalid pipeline 'function(no-op-function'
+; CHECK-UNBALANCED7: unable to parse pass pipeline description
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='function(function(no-op-function)' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-UNBALANCED8
-; CHECK-UNBALANCED8: invalid pipeline 'function(function(no-op-function)'
+; CHECK-UNBALANCED8: unable to parse pass pipeline description
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='no-op-module,)' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-UNBALANCED9
-; CHECK-UNBALANCED9: invalid pipeline 'no-op-module,)'
+; CHECK-UNBALANCED9: unable to parse pass pipeline description
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='no-op-function,)' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-UNBALANCED10
-; CHECK-UNBALANCED10: invalid pipeline 'no-op-function,)'
+; CHECK-UNBALANCED10: unable to parse pass pipeline description
; RUN: opt -disable-output -debug-pass-manager \
; RUN: -passes=no-op-cgscc,no-op-cgscc %s 2>&1 \
@@ -176,86 +176,37 @@
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='function(no-op-function)function(no-op-function)' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-MISSING-COMMA1
-; CHECK-MISSING-COMMA1: invalid pipeline 'function(no-op-function)function(no-op-function)'
+; CHECK-MISSING-COMMA1: unable to parse pass pipeline description
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='function()' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-EMPTY-INNER-PIPELINE
-; CHECK-EMPTY-INNER-PIPELINE: unknown function pass ''
+; CHECK-EMPTY-INNER-PIPELINE: unable to parse pass pipeline description
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='no-op-module(no-op-module,whatever)' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-PIPELINE-ON-MODULE-PASS
-; CHECK-PIPELINE-ON-MODULE-PASS: invalid use of 'no-op-module' pass as module pipeline
+; CHECK-PIPELINE-ON-MODULE-PASS: unable to parse pass pipeline description
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='no-op-cgscc(no-op-cgscc,whatever)' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-PIPELINE-ON-CGSCC-PASS
-; CHECK-PIPELINE-ON-CGSCC-PASS: invalid use of 'no-op-cgscc' pass as cgscc pipeline
+; CHECK-PIPELINE-ON-CGSCC-PASS: unable to parse pass pipeline description
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='no-op-function(no-op-function,whatever)' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-PIPELINE-ON-FUNCTION-PASS
-; CHECK-PIPELINE-ON-FUNCTION-PASS: invalid use of 'no-op-function' pass as function pipeline
+; CHECK-PIPELINE-ON-FUNCTION-PASS: unable to parse pass pipeline description
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='no-op-loop(no-op-loop,whatever)' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-PIPELINE-ON-LOOP-PASS
-; CHECK-PIPELINE-ON-LOOP-PASS: invalid use of 'no-op-loop' pass as loop pipeline
+; CHECK-PIPELINE-ON-LOOP-PASS: unable to parse pass pipeline description
; RUN: not opt -disable-output -debug-pass-manager \
; RUN: -passes='no-op-function()' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-EMPTY-PIPELINE-ON-PASS
-; CHECK-EMPTY-PIPELINE-ON-PASS: invalid use of 'no-op-function' pass as function pipeline
-
-; RUN: not opt -passes='no-op-module,bad' \
-; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=CHECK-UNKNOWN-MODULE
-; CHECK-UNKNOWN-MODULE: opt: unknown module pass 'bad'
-
-; RUN: not opt -passes='no-op-loop,bad' \
-; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=CHECK-UNKNOWN-LOOP
-; CHECK-UNKNOWN-LOOP: opt: unknown loop pass 'bad'
-
-; RUN: not opt -passes='no-op-cgscc,bad' \
-; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=CHECK-UNKNOWN-CGSCC
-; CHECK-UNKNOWN-CGSCC: opt: unknown cgscc pass 'bad'
-
-; RUN: not opt -passes='no-op-function,bad' \
-; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=CHECK-UNKNOWN-FUNCTION
-; RUN: not opt -passes='function(bad,pipeline,text)' \
-; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=CHECK-UNKNOWN-FUNCTION
-; RUN: not opt -passes='module(no-op-module,function(bad,pipeline,text))' \
-; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=CHECK-UNKNOWN-FUNCTION
-; RUN: not opt -passes='no-op-module,function(bad,pipeline,text)' \
-; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=CHECK-UNKNOWN-FUNCTION
-; RUN: not opt -passes='module(cgscc(function(bad,pipeline,text)))' \
-; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=CHECK-UNKNOWN-FUNCTION
-; CHECK-UNKNOWN-FUNCTION: opt: unknown function pass 'bad'
-
-; RUN: not opt -aa-pipeline=bad -passes=no-op-function \
-; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=AA-PIPELINE-ERR
-; AA-PIPELINE-ERR: unknown alias analysis name 'bad'
-; RUN: opt -passes-ep-peephole=bad -passes=no-op-function \
-; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=PASSES-EP-PEEPHOLE-ERR
-; PASSES-EP-PEEPHOLE-ERR: Could not parse pipeline 'bad'. I'm going to ignore it.
-; RUN: opt -passes-ep-late-loop-optimizations=bad -passes=no-op-function \
-; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=PASSES-EP-LATELOOPOPT-ERR
-; PASSES-EP-LATELOOPOPT-ERR: Could not parse pipeline 'bad'. I'm going to ignore it.
-; RUN: opt -passes-ep-loop-optimizer-end=bad -passes=no-op-function \
-; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=PASSES-EP-LOOPOPTEND-ERR
-; PASSES-EP-LOOPOPTEND-ERR: Could not parse pipeline 'bad'. I'm going to ignore it.
-; RUN: opt -passes-ep-scalar-optimizer-late=bad -passes=no-op-function \
-; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=PASSES-EP-SCALAROPTLATE-ERR
-; PASSES-EP-SCALAROPTLATE-ERR: Could not parse pipeline 'bad'. I'm going to ignore it.
-; RUN: opt -passes-ep-cgscc-optimizer-late=bad -passes=no-op-function \
-; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=PASSES-EP-CGSCCOPTLATE-ERR
-; PASSES-EP-CGSCCOPTLATE-ERR: Could not parse pipeline 'bad'. I'm going to ignore it.
-; RUN: opt -passes-ep-vectorizer-start=bad -passes=no-op-function \
-; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=PASSES-EP-VECTORIZERSTART-ERR
-; PASSES-EP-VECTORIZERSTART-ERR: Could not parse pipeline 'bad'. I'm going to ignore it.
-; RUN: opt -passes-ep-pipeline-start=bad -passes=no-op-function \
-; RUN: /dev/null -disable-output 2>&1 | FileCheck %s -check-prefix=PASSES-EP-PIPELINESTART-ERR
-; PASSES-EP-PIPELINESTART-ERR: Could not parse pipeline 'bad'. I'm going to ignore it.
+; CHECK-EMPTY-PIPELINE-ON-PASS: unable to parse pass pipeline description
define void @f() {
entry:
Modified: llvm/trunk/test/tools/llvm-lto2/X86/pipeline.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-lto2/X86/pipeline.ll?rev=344524&r1=344523&r2=344524&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-lto2/X86/pipeline.ll (original)
+++ llvm/trunk/test/tools/llvm-lto2/X86/pipeline.ll Mon Oct 15 08:36:08 2018
@@ -32,11 +32,11 @@ define void @patatino() {
; RUN: -r %t1.bc,patatino,px -opt-pipeline foogoo 2>&1 | \
; RUN: FileCheck %s --check-prefix=ERR
-; ERR: LLVM ERROR: unable to parse pass pipeline description 'foogoo': unknown pass name 'foogoo'
+; ERR: LLVM ERROR: unable to parse pass pipeline description: foogoo
; RUN: not llvm-lto2 run %t1.bc -o %t.o \
; RUN: -r %t1.bc,patatino,px -aa-pipeline patatino \
; RUN: -opt-pipeline loweratomic 2>&1 | \
; RUN: FileCheck %s --check-prefix=AAERR
-; AAERR: LLVM ERROR: unable to parse AA pipeline description 'patatino': unknown alias analysis name 'patatino'
+; AAERR: LLVM ERROR: unable to parse AA pipeline description: patatino
Modified: llvm/trunk/test/tools/llvm-opt-fuzzer/command-line.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-opt-fuzzer/command-line.ll?rev=344524&r1=344523&r2=344524&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-opt-fuzzer/command-line.ll (original)
+++ llvm/trunk/test/tools/llvm-opt-fuzzer/command-line.ll Mon Oct 15 08:36:08 2018
@@ -13,7 +13,7 @@
; Don't start with incorrect passes specified
; RUN: not llvm-opt-fuzzer %t -ignore_remaining_args=1 -mtriple x86_64 -passes no-pass 2>&1 | FileCheck -check-prefix=PIPELINE %s
-; PIPELINE: unknown pass name 'no-pass'
+; PIPELINE: can't parse pass pipeline
; Correct command line
; RUN: llvm-opt-fuzzer %t -ignore_remaining_args=1 -mtriple x86_64 -passes instcombine 2>&1 | FileCheck -check-prefix=CORRECT %s
Modified: llvm/trunk/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp?rev=344524&r1=344523&r2=344524&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp (original)
+++ llvm/trunk/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp Mon Oct 15 08:36:08 2018
@@ -144,10 +144,9 @@ extern "C" int LLVMFuzzerTestOneInput(co
PB.registerLoopAnalyses(LAM);
PB.crossRegisterProxies(LAM, FAM, CGAM, MAM);
- auto Err = PB.parsePassPipeline(MPM, PassPipeline, false, false);
- assert(!Err && "Should have been checked during fuzzer initialization");
- // Only fail with assert above, otherwise ignore the parsing error.
- consumeError(std::move(Err));
+ bool Ok = PB.parsePassPipeline(MPM, PassPipeline, false, false);
+ assert(Ok && "Should have been checked during fuzzer initialization");
+ (void)Ok; // silence unused variable warning on release builds
// Run passes which we need to test
//
@@ -236,8 +235,8 @@ extern "C" LLVM_ATTRIBUTE_USED int LLVMF
PassBuilder PB(TM.get());
ModulePassManager MPM;
- if (auto Err = PB.parsePassPipeline(MPM, PassPipeline, false, false)) {
- errs() << *argv[0] << ": " << toString(std::move(Err)) << "\n";
+ if (!PB.parsePassPipeline(MPM, PassPipeline, false, false)) {
+ errs() << *argv[0] << ": can't parse pass pipeline\n";
exit(1);
}
Modified: llvm/trunk/tools/opt/NewPMDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/NewPMDriver.cpp?rev=344524&r1=344523&r2=344524&view=diff
==============================================================================
--- llvm/trunk/tools/opt/NewPMDriver.cpp (original)
+++ llvm/trunk/tools/opt/NewPMDriver.cpp Mon Oct 15 08:36:08 2018
@@ -124,12 +124,12 @@ bool tryParsePipelineText(PassBuilder &P
// Verify the pipeline is parseable:
PassManagerT PM;
- if (auto Err = PB.parsePassPipeline(PM, PipelineText)) {
- errs() << "Could not parse pipeline '" << PipelineText
- << "'. I'm going to ignore it.\n";
- return false;
- }
- return true;
+ if (PB.parsePassPipeline(PM, PipelineText))
+ return true;
+
+ errs() << "Could not parse pipeline '" << PipelineText
+ << "'. I'm going to igore it.\n";
+ return false;
}
/// If one of the EPPipeline command line options was given, register callbacks
@@ -137,61 +137,50 @@ bool tryParsePipelineText(PassBuilder &P
static void registerEPCallbacks(PassBuilder &PB, bool VerifyEachPass,
bool DebugLogging) {
if (tryParsePipelineText<FunctionPassManager>(PB, PeepholeEPPipeline))
- PB.registerPeepholeEPCallback(
- [&PB, VerifyEachPass, DebugLogging](
- FunctionPassManager &PM, PassBuilder::OptimizationLevel Level) {
- ExitOnError Err("Unable to parse PeepholeEP pipeline: ");
- Err(PB.parsePassPipeline(PM, PeepholeEPPipeline, VerifyEachPass,
- DebugLogging));
- });
+ PB.registerPeepholeEPCallback([&PB, VerifyEachPass, DebugLogging](
+ FunctionPassManager &PM, PassBuilder::OptimizationLevel Level) {
+ PB.parsePassPipeline(PM, PeepholeEPPipeline, VerifyEachPass,
+ DebugLogging);
+ });
if (tryParsePipelineText<LoopPassManager>(PB,
LateLoopOptimizationsEPPipeline))
PB.registerLateLoopOptimizationsEPCallback(
[&PB, VerifyEachPass, DebugLogging](
LoopPassManager &PM, PassBuilder::OptimizationLevel Level) {
- ExitOnError Err("Unable to parse LateLoopOptimizationsEP pipeline: ");
- Err(PB.parsePassPipeline(PM, LateLoopOptimizationsEPPipeline,
- VerifyEachPass, DebugLogging));
+ PB.parsePassPipeline(PM, LateLoopOptimizationsEPPipeline,
+ VerifyEachPass, DebugLogging);
});
if (tryParsePipelineText<LoopPassManager>(PB, LoopOptimizerEndEPPipeline))
- PB.registerLoopOptimizerEndEPCallback(
- [&PB, VerifyEachPass, DebugLogging](
- LoopPassManager &PM, PassBuilder::OptimizationLevel Level) {
- ExitOnError Err("Unable to parse LoopOptimizerEndEP pipeline: ");
- Err(PB.parsePassPipeline(PM, LoopOptimizerEndEPPipeline,
- VerifyEachPass, DebugLogging));
- });
+ PB.registerLoopOptimizerEndEPCallback([&PB, VerifyEachPass, DebugLogging](
+ LoopPassManager &PM, PassBuilder::OptimizationLevel Level) {
+ PB.parsePassPipeline(PM, LoopOptimizerEndEPPipeline, VerifyEachPass,
+ DebugLogging);
+ });
if (tryParsePipelineText<FunctionPassManager>(PB,
ScalarOptimizerLateEPPipeline))
PB.registerScalarOptimizerLateEPCallback(
[&PB, VerifyEachPass, DebugLogging](
FunctionPassManager &PM, PassBuilder::OptimizationLevel Level) {
- ExitOnError Err("Unable to parse ScalarOptimizerLateEP pipeline: ");
- Err(PB.parsePassPipeline(PM, ScalarOptimizerLateEPPipeline,
- VerifyEachPass, DebugLogging));
+ PB.parsePassPipeline(PM, ScalarOptimizerLateEPPipeline,
+ VerifyEachPass, DebugLogging);
});
if (tryParsePipelineText<CGSCCPassManager>(PB, CGSCCOptimizerLateEPPipeline))
- PB.registerCGSCCOptimizerLateEPCallback(
- [&PB, VerifyEachPass, DebugLogging](
- CGSCCPassManager &PM, PassBuilder::OptimizationLevel Level) {
- ExitOnError Err("Unable to parse CGSCCOptimizerLateEP pipeline: ");
- Err(PB.parsePassPipeline(PM, CGSCCOptimizerLateEPPipeline,
- VerifyEachPass, DebugLogging));
- });
+ PB.registerCGSCCOptimizerLateEPCallback([&PB, VerifyEachPass, DebugLogging](
+ CGSCCPassManager &PM, PassBuilder::OptimizationLevel Level) {
+ PB.parsePassPipeline(PM, CGSCCOptimizerLateEPPipeline, VerifyEachPass,
+ DebugLogging);
+ });
if (tryParsePipelineText<FunctionPassManager>(PB, VectorizerStartEPPipeline))
- PB.registerVectorizerStartEPCallback(
- [&PB, VerifyEachPass, DebugLogging](
- FunctionPassManager &PM, PassBuilder::OptimizationLevel Level) {
- ExitOnError Err("Unable to parse VectorizerStartEP pipeline: ");
- Err(PB.parsePassPipeline(PM, VectorizerStartEPPipeline,
- VerifyEachPass, DebugLogging));
- });
+ PB.registerVectorizerStartEPCallback([&PB, VerifyEachPass, DebugLogging](
+ FunctionPassManager &PM, PassBuilder::OptimizationLevel Level) {
+ PB.parsePassPipeline(PM, VectorizerStartEPPipeline, VerifyEachPass,
+ DebugLogging);
+ });
if (tryParsePipelineText<ModulePassManager>(PB, PipelineStartEPPipeline))
PB.registerPipelineStartEPCallback(
[&PB, VerifyEachPass, DebugLogging](ModulePassManager &PM) {
- ExitOnError Err("Unable to parse PipelineStartEP pipeline: ");
- Err(PB.parsePassPipeline(PM, PipelineStartEPPipeline, VerifyEachPass,
- DebugLogging));
+ PB.parsePassPipeline(PM, PipelineStartEPPipeline, VerifyEachPass,
+ DebugLogging);
});
}
@@ -269,8 +258,8 @@ bool llvm::runPassPipeline(StringRef Arg
// Specially handle the alias analysis manager so that we can register
// a custom pipeline of AA passes with it.
AAManager AA;
- if (auto Err = PB.parseAAPipeline(AA, AAPipeline)) {
- errs() << Arg0 << ": " << toString(std::move(Err)) << "\n";
+ if (!PB.parseAAPipeline(AA, AAPipeline)) {
+ errs() << Arg0 << ": unable to parse AA pipeline description.\n";
return false;
}
@@ -295,9 +284,8 @@ bool llvm::runPassPipeline(StringRef Arg
if (EnableDebugify)
MPM.addPass(NewPMDebugifyPass());
- if (auto Err =
- PB.parsePassPipeline(MPM, PassPipeline, VerifyEachPass, DebugPM)) {
- errs() << Arg0 << ": " << toString(std::move(Err)) << "\n";
+ if (!PB.parsePassPipeline(MPM, PassPipeline, VerifyEachPass, DebugPM)) {
+ errs() << Arg0 << ": unable to parse pass pipeline description.\n";
return false;
}
Modified: llvm/trunk/unittests/IR/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/CMakeLists.txt?rev=344524&r1=344523&r2=344524&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/CMakeLists.txt (original)
+++ llvm/trunk/unittests/IR/CMakeLists.txt Mon Oct 15 08:36:08 2018
@@ -40,5 +40,3 @@ add_llvm_unittest(IRTests
VerifierTest.cpp
WaymarkTest.cpp
)
-
-target_link_libraries(IRTests PRIVATE LLVMTestingSupport)
Modified: llvm/trunk/unittests/IR/PassBuilderCallbacksTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/PassBuilderCallbacksTest.cpp?rev=344524&r1=344523&r2=344524&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/PassBuilderCallbacksTest.cpp (original)
+++ llvm/trunk/unittests/IR/PassBuilderCallbacksTest.cpp Mon Oct 15 08:36:08 2018
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Testing/Support/Error.h"
#include <functional>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@@ -461,7 +460,7 @@ TEST_F(ModuleCallbacksTest, Passes) {
.WillOnce(Invoke(getAnalysisResult));
StringRef PipelineText = "test-transform";
- ASSERT_THAT_ERROR(PB.parsePassPipeline(PM, PipelineText, true), Succeeded())
+ ASSERT_TRUE(PB.parsePassPipeline(PM, PipelineText, true))
<< "Pipeline was: " << PipelineText;
PM.run(*M, AM);
@@ -495,7 +494,7 @@ TEST_F(ModuleCallbacksTest, Instrumented
.InSequence(PISequence);
StringRef PipelineText = "test-transform";
- ASSERT_THAT_ERROR(PB.parsePassPipeline(PM, PipelineText, true), Succeeded())
+ ASSERT_TRUE(PB.parsePassPipeline(PM, PipelineText, true))
<< "Pipeline was: " << PipelineText;
PM.run(*M, AM);
@@ -526,7 +525,7 @@ TEST_F(ModuleCallbacksTest, Instrumented
.Times(0);
StringRef PipelineText = "test-transform";
- ASSERT_THAT_ERROR(PB.parsePassPipeline(PM, PipelineText, true), Succeeded())
+ ASSERT_TRUE(PB.parsePassPipeline(PM, PipelineText, true))
<< "Pipeline was: " << PipelineText;
PM.run(*M, AM);
@@ -538,7 +537,7 @@ TEST_F(FunctionCallbacksTest, Passes) {
.WillOnce(Invoke(getAnalysisResult));
StringRef PipelineText = "test-transform";
- ASSERT_THAT_ERROR(PB.parsePassPipeline(PM, PipelineText, true), Succeeded())
+ ASSERT_TRUE(PB.parsePassPipeline(PM, PipelineText, true))
<< "Pipeline was: " << PipelineText;
PM.run(*M, AM);
}
@@ -572,7 +571,7 @@ TEST_F(FunctionCallbacksTest, Instrument
.InSequence(PISequence);
StringRef PipelineText = "test-transform";
- ASSERT_THAT_ERROR(PB.parsePassPipeline(PM, PipelineText, true), Succeeded())
+ ASSERT_TRUE(PB.parsePassPipeline(PM, PipelineText, true))
<< "Pipeline was: " << PipelineText;
PM.run(*M, AM);
}
@@ -605,7 +604,7 @@ TEST_F(FunctionCallbacksTest, Instrument
.Times(0);
StringRef PipelineText = "test-transform";
- ASSERT_THAT_ERROR(PB.parsePassPipeline(PM, PipelineText, true), Succeeded())
+ ASSERT_TRUE(PB.parsePassPipeline(PM, PipelineText, true))
<< "Pipeline was: " << PipelineText;
PM.run(*M, AM);
}
@@ -616,7 +615,7 @@ TEST_F(LoopCallbacksTest, Passes) {
.WillOnce(WithArgs<0, 1, 2>(Invoke(getAnalysisResult)));
StringRef PipelineText = "test-transform";
- ASSERT_THAT_ERROR(PB.parsePassPipeline(PM, PipelineText, true), Succeeded())
+ ASSERT_TRUE(PB.parsePassPipeline(PM, PipelineText, true))
<< "Pipeline was: " << PipelineText;
PM.run(*M, AM);
}
@@ -651,7 +650,7 @@ TEST_F(LoopCallbacksTest, InstrumentedPa
.InSequence(PISequence);
StringRef PipelineText = "test-transform";
- ASSERT_THAT_ERROR(PB.parsePassPipeline(PM, PipelineText, true), Succeeded())
+ ASSERT_TRUE(PB.parsePassPipeline(PM, PipelineText, true))
<< "Pipeline was: " << PipelineText;
PM.run(*M, AM);
}
@@ -683,7 +682,7 @@ TEST_F(LoopCallbacksTest, InstrumentedSk
.Times(0);
StringRef PipelineText = "test-transform";
- ASSERT_THAT_ERROR(PB.parsePassPipeline(PM, PipelineText, true), Succeeded())
+ ASSERT_TRUE(PB.parsePassPipeline(PM, PipelineText, true))
<< "Pipeline was: " << PipelineText;
PM.run(*M, AM);
}
@@ -694,7 +693,7 @@ TEST_F(CGSCCCallbacksTest, Passes) {
.WillOnce(WithArgs<0, 1, 2>(Invoke(getAnalysisResult)));
StringRef PipelineText = "test-transform";
- ASSERT_THAT_ERROR(PB.parsePassPipeline(PM, PipelineText, true), Succeeded())
+ ASSERT_TRUE(PB.parsePassPipeline(PM, PipelineText, true))
<< "Pipeline was: " << PipelineText;
PM.run(*M, AM);
}
@@ -728,7 +727,7 @@ TEST_F(CGSCCCallbacksTest, InstrumentedP
.InSequence(PISequence);
StringRef PipelineText = "test-transform";
- ASSERT_THAT_ERROR(PB.parsePassPipeline(PM, PipelineText, true), Succeeded())
+ ASSERT_TRUE(PB.parsePassPipeline(PM, PipelineText, true))
<< "Pipeline was: " << PipelineText;
PM.run(*M, AM);
}
@@ -760,7 +759,7 @@ TEST_F(CGSCCCallbacksTest, InstrumentedS
.Times(0);
StringRef PipelineText = "test-transform";
- ASSERT_THAT_ERROR(PB.parsePassPipeline(PM, PipelineText, true), Succeeded())
+ ASSERT_TRUE(PB.parsePassPipeline(PM, PipelineText, true))
<< "Pipeline was: " << PipelineText;
PM.run(*M, AM);
}
@@ -775,7 +774,7 @@ TEST_F(ModuleCallbacksTest, AnalysisUtil
EXPECT_CALL(AnalysisHandle, invalidate(HasName("<string>"), _, _));
StringRef PipelineText = "require<test-analysis>,invalidate<test-analysis>";
- ASSERT_THAT_ERROR(PB.parsePassPipeline(PM, PipelineText, true), Succeeded())
+ ASSERT_TRUE(PB.parsePassPipeline(PM, PipelineText, true))
<< "Pipeline was: " << PipelineText;
PM.run(*M, AM);
}
@@ -785,7 +784,7 @@ TEST_F(CGSCCCallbacksTest, PassUtilities
EXPECT_CALL(AnalysisHandle, invalidate(HasName("(foo)"), _, _));
StringRef PipelineText = "require<test-analysis>,invalidate<test-analysis>";
- ASSERT_THAT_ERROR(PB.parsePassPipeline(PM, PipelineText, true), Succeeded())
+ ASSERT_TRUE(PB.parsePassPipeline(PM, PipelineText, true))
<< "Pipeline was: " << PipelineText;
PM.run(*M, AM);
}
@@ -795,7 +794,7 @@ TEST_F(FunctionCallbacksTest, AnalysisUt
EXPECT_CALL(AnalysisHandle, invalidate(HasName("foo"), _, _));
StringRef PipelineText = "require<test-analysis>,invalidate<test-analysis>";
- ASSERT_THAT_ERROR(PB.parsePassPipeline(PM, PipelineText, true), Succeeded())
+ ASSERT_TRUE(PB.parsePassPipeline(PM, PipelineText, true))
<< "Pipeline was: " << PipelineText;
PM.run(*M, AM);
}
@@ -806,7 +805,7 @@ TEST_F(LoopCallbacksTest, PassUtilities)
StringRef PipelineText = "require<test-analysis>,invalidate<test-analysis>";
- ASSERT_THAT_ERROR(PB.parsePassPipeline(PM, PipelineText, true), Succeeded())
+ ASSERT_TRUE(PB.parsePassPipeline(PM, PipelineText, true))
<< "Pipeline was: " << PipelineText;
PM.run(*M, AM);
}
@@ -846,13 +845,13 @@ TEST_F(ModuleCallbacksTest, ParseTopLeve
StringRef PipelineText =
"another-pipeline(test-transform,invalidate<test-analysis>)";
- ASSERT_THAT_ERROR(PB.parsePassPipeline(PM, PipelineText, true), Succeeded())
+ ASSERT_TRUE(PB.parsePassPipeline(PM, PipelineText, true))
<< "Pipeline was: " << PipelineText;
PM.run(*M, AM);
/// Test the negative case
PipelineText = "another-pipeline(instcombine)";
- ASSERT_THAT_ERROR(PB.parsePassPipeline(PM, PipelineText, true), Failed())
+ ASSERT_FALSE(PB.parsePassPipeline(PM, PipelineText, true))
<< "Pipeline was: " << PipelineText;
}
} // end anonymous namespace
Modified: llvm/trunk/unittests/Passes/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Passes/CMakeLists.txt?rev=344524&r1=344523&r2=344524&view=diff
==============================================================================
--- llvm/trunk/unittests/Passes/CMakeLists.txt (original)
+++ llvm/trunk/unittests/Passes/CMakeLists.txt Mon Oct 15 08:36:08 2018
@@ -12,7 +12,6 @@ add_llvm_unittest(PluginsTests
PluginsTest.cpp
)
export_executable_symbols(PluginsTests)
-target_link_libraries(PluginsTests PRIVATE LLVMTestingSupport)
set(LLVM_LINK_COMPONENTS)
add_llvm_loadable_module(TestPlugin
Modified: llvm/trunk/unittests/Passes/PluginsTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Passes/PluginsTest.cpp?rev=344524&r1=344523&r2=344524&view=diff
==============================================================================
--- llvm/trunk/unittests/Passes/PluginsTest.cpp (original)
+++ llvm/trunk/unittests/Passes/PluginsTest.cpp Mon Oct 15 08:36:08 2018
@@ -15,7 +15,6 @@
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Path.h"
-#include "llvm/Testing/Support/Error.h"
#include "llvm/Transforms/Scalar/LoopPassManager.h"
#include "gtest/gtest.h"
@@ -55,8 +54,8 @@ TEST(PluginsTests, LoadPlugin) {
PassBuilder PB;
ModulePassManager PM;
- ASSERT_THAT_ERROR(PB.parsePassPipeline(PM, "plugin-pass"), Failed());
+ ASSERT_FALSE(PB.parsePassPipeline(PM, "plugin-pass"));
Plugin->registerPassBuilderCallbacks(PB);
- ASSERT_THAT_ERROR(PB.parsePassPipeline(PM, "plugin-pass"), Succeeded());
+ ASSERT_TRUE(PB.parsePassPipeline(PM, "plugin-pass"));
}
More information about the llvm-commits
mailing list