Skip to content

Commit a6255e4

Browse files
authored
Revert "[LLVM] Add flags to crash the opt/codegen pipeline" (llvm#200977)
Reverts llvm#200967 Test failing on some buildbots: https://lab.llvm.org/buildbot/#/builders/11/builds/41237
1 parent ccd2606 commit a6255e4

8 files changed

Lines changed: 22 additions & 116 deletions

File tree

llvm/include/llvm/Transforms/Utils/TriggerCrashPass.h

Lines changed: 0 additions & 39 deletions
This file was deleted.

llvm/lib/CodeGen/TargetPassConfig.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
#include "llvm/Transforms/ObjCARC.h"
5151
#include "llvm/Transforms/Scalar.h"
5252
#include "llvm/Transforms/Utils.h"
53-
#include "llvm/Transforms/Utils/TriggerCrashPass.h"
5453
#include <cassert>
5554
#include <optional>
5655
#include <string>
@@ -100,11 +99,6 @@ static cl::opt<bool> DisableConstantHoisting("disable-constant-hoisting",
10099
cl::Hidden, cl::desc("Disable ConstantHoisting"));
101100
static cl::opt<bool> DisableCGP("disable-cgp", cl::Hidden,
102101
cl::desc("Disable Codegen Prepare"));
103-
104-
static cl::opt<bool>
105-
TriggerCrash("codegen-pipeline-trigger-crash", cl::init(false), cl::Hidden,
106-
cl::desc("Trigger crash in codegen pipeline"));
107-
108102
static cl::opt<bool> DisableCopyProp("disable-copyprop", cl::Hidden,
109103
cl::desc("Disable Copy Propagation pass"));
110104
static cl::opt<bool> DisablePartialLibcallInlining("disable-partial-libcall-inlining",
@@ -1092,10 +1086,6 @@ bool TargetPassConfig::addISelPasses() {
10921086
addPass(createPreISelIntrinsicLoweringPass());
10931087
addPass(createExpandIRInstsPass(getOptLevel()));
10941088
addIRPasses();
1095-
1096-
if (TriggerCrash)
1097-
addPass(createTriggerCrashFunctionPass());
1098-
10991089
addCodeGenPrepare();
11001090
addPassesToHandleExceptions();
11011091
addISelPrepare();

llvm/lib/Passes/PassBuilder.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,6 @@
386386
#include "llvm/Transforms/Utils/StripGCRelocates.h"
387387
#include "llvm/Transforms/Utils/StripNonLineTableDebugInfo.h"
388388
#include "llvm/Transforms/Utils/SymbolRewriter.h"
389-
#include "llvm/Transforms/Utils/TriggerCrashPass.h"
390389
#include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h"
391390
#include "llvm/Transforms/Utils/UnifyLoopExits.h"
392391
#include "llvm/Transforms/Vectorize/LoadStoreVectorizer.h"
@@ -424,6 +423,28 @@ bool applyMIRDebugify(DIBuilder &DIB, Function &F, ModuleAnalysisManager &AM) {
424423
});
425424
}
426425

426+
// Passes for testing crashes.
427+
// DO NOT USE THIS EXCEPT FOR TESTING!
428+
class TriggerCrashModulePass
429+
: public OptionalPassInfoMixin<TriggerCrashModulePass> {
430+
public:
431+
PreservedAnalyses run(Module &, ModuleAnalysisManager &) {
432+
abort();
433+
return PreservedAnalyses::all();
434+
}
435+
static StringRef name() { return "TriggerCrashModulePass"; }
436+
};
437+
438+
class TriggerCrashFunctionPass
439+
: public OptionalPassInfoMixin<TriggerCrashFunctionPass> {
440+
public:
441+
PreservedAnalyses run(Function &, FunctionAnalysisManager &) {
442+
abort();
443+
return PreservedAnalyses::all();
444+
}
445+
static StringRef name() { return "TriggerCrashFunctionPass"; }
446+
};
447+
427448
// A pass for testing message reporting of -verify-each failures.
428449
// DO NOT USE THIS EXCEPT FOR TESTING!
429450
class TriggerVerifierErrorPass

llvm/lib/Passes/PassBuilderPipelines.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@
151151
#include "llvm/Transforms/Utils/NameAnonGlobals.h"
152152
#include "llvm/Transforms/Utils/RelLookupTableConverter.h"
153153
#include "llvm/Transforms/Utils/SimplifyCFGOptions.h"
154-
#include "llvm/Transforms/Utils/TriggerCrashPass.h"
155154
#include "llvm/Transforms/Vectorize/LoopVectorize.h"
156155
#include "llvm/Transforms/Vectorize/SLPVectorizer.h"
157156
#include "llvm/Transforms/Vectorize/VectorCombine.h"
@@ -197,10 +196,6 @@ static cl::opt<bool> EnablePostPGOLoopRotation(
197196
"enable-post-pgo-loop-rotation", cl::init(true), cl::Hidden,
198197
cl::desc("Run the loop rotation transformation after PGO instrumentation"));
199198

200-
static cl::opt<bool>
201-
TriggerCrash("opt-pipeline-trigger-crash", cl::init(false), cl::Hidden,
202-
cl::desc("Trigger crash in optimization pipeline"));
203-
204199
static cl::opt<bool> EnableGlobalAnalyses(
205200
"enable-global-analyses", cl::init(true), cl::Hidden,
206201
cl::desc("Enable inter-procedural analyses"));
@@ -1781,9 +1776,6 @@ PassBuilder::buildPerModuleDefaultPipeline(OptimizationLevel Level,
17811776
// Force any function attributes we want the rest of the pipeline to observe.
17821777
MPM.addPass(ForceFunctionAttrsPass());
17831778

1784-
if (TriggerCrash)
1785-
MPM.addPass(createModuleToFunctionPassAdaptor(TriggerCrashFunctionPass()));
1786-
17871779
if (PGOOpt && PGOOpt->DebugInfoForProfiling)
17881780
MPM.addPass(createModuleToFunctionPassAdaptor(AddDiscriminatorsPass()));
17891781

llvm/lib/Transforms/Utils/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ add_llvm_component_library(LLVMTransformUtils
9191
SplitModuleByCategory.cpp
9292
StripNonLineTableDebugInfo.cpp
9393
SymbolRewriter.cpp
94-
TriggerCrashPass.cpp
9594
UnifyFunctionExitNodes.cpp
9695
UnifyLoopExits.cpp
9796
Utils.cpp

llvm/lib/Transforms/Utils/TriggerCrashPass.cpp

Lines changed: 0 additions & 43 deletions
This file was deleted.

llvm/test/Other/trigger-crash-flags.ll

Lines changed: 0 additions & 13 deletions
This file was deleted.

llvm/utils/gn/secondary/llvm/lib/Transforms/Utils/BUILD.gn

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ static_library("Utils") {
9999
"StripGCRelocates.cpp",
100100
"StripNonLineTableDebugInfo.cpp",
101101
"SymbolRewriter.cpp",
102-
"TriggerCrashPass.cpp",
103102
"UnifyFunctionExitNodes.cpp",
104103
"UnifyLoopExits.cpp",
105104
"Utils.cpp",

0 commit comments

Comments
 (0)