File tree 3 files changed +15
-1
lines changed
3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 19
19
#include " llvm/Transforms/Scalar/StructurizeCFG.h"
20
20
#include " llvm/Transforms/Utils/FixIrreducible.h"
21
21
#include " llvm/Transforms/Utils/LCSSA.h"
22
+ #include " llvm/Transforms/Utils/LowerSwitch.h"
22
23
#include " llvm/Transforms/Utils/UnifyLoopExits.h"
23
24
24
25
using namespace llvm ;
@@ -35,6 +36,16 @@ AMDGPUCodeGenPassBuilder::AMDGPUCodeGenPassBuilder(
35
36
ShadowStackGCLoweringPass>();
36
37
}
37
38
39
+ void AMDGPUCodeGenPassBuilder::addCodeGenPrepare (AddIRPass &addPass) const {
40
+ Base::addCodeGenPrepare (addPass);
41
+
42
+ // LowerSwitch pass may introduce unreachable blocks that can cause unexpected
43
+ // behavior for subsequent passes. Placing it here seems better that these
44
+ // blocks would get cleaned up by UnreachableBlockElim inserted next in the
45
+ // pass flow.
46
+ addPass (LowerSwitchPass ());
47
+ }
48
+
38
49
void AMDGPUCodeGenPassBuilder::addPreISel (AddIRPass &addPass) const {
39
50
const bool LateCFGStructurize = AMDGPUTargetMachine::EnableLateStructurizeCFG;
40
51
const bool DisableStructurizer = AMDGPUTargetMachine::DisableStructurizer;
Original file line number Diff line number Diff line change @@ -19,10 +19,12 @@ class GCNTargetMachine;
19
19
class AMDGPUCodeGenPassBuilder
20
20
: public CodeGenPassBuilder<AMDGPUCodeGenPassBuilder, GCNTargetMachine> {
21
21
public:
22
+ using Base = CodeGenPassBuilder<AMDGPUCodeGenPassBuilder, GCNTargetMachine>;
23
+
22
24
AMDGPUCodeGenPassBuilder (GCNTargetMachine &TM,
23
25
const CGPassBuilderOption &Opts,
24
26
PassInstrumentationCallbacks *PIC);
25
-
27
+ void addCodeGenPrepare (AddIRPass &) const ;
26
28
void addPreISel (AddIRPass &addPass) const ;
27
29
void addAsmPrinter (AddMachinePass &, CreateMCStreamer) const ;
28
30
Error addInstSelector (AddMachinePass &) const ;
Original file line number Diff line number Diff line change 67
67
#include " llvm/Transforms/Scalar/GVN.h"
68
68
#include " llvm/Transforms/Scalar/InferAddressSpaces.h"
69
69
#include " llvm/Transforms/Utils.h"
70
+ #include " llvm/Transforms/Utils/LowerSwitch.h"
70
71
#include " llvm/Transforms/Utils/SimplifyLibCalls.h"
71
72
#include " llvm/Transforms/Vectorize/LoadStoreVectorizer.h"
72
73
#include < optional>
You can’t perform that action at this time.
0 commit comments