1515#ifndef BREAKCONSTANTGEPS_H
1616#define BREAKCONSTANTGEPS_H
1717
18+ #if LLVM_VERSION_MAJOR > 16
19+ #include " llvm/Passes/PassBuilder.h"
20+ #include " llvm/Transforms/Utils/UnifyFunctionExitNodes.h"
21+ #endif
1822
1923namespace SVF
2024{
@@ -77,6 +81,25 @@ class MergeFunctionRets : public ModulePass
7781 const Function& fun = *iter;
7882 if (fun.isDeclaration ())
7983 continue ;
84+ #if LLVM_VERSION_MAJOR > 16
85+ llvm::PassBuilder PB;
86+ llvm::LoopAnalysisManager LAM;
87+ llvm::FunctionAnalysisManager FAM;
88+ llvm::CGSCCAnalysisManager CGAM;
89+ llvm::ModuleAnalysisManager MAM;
90+
91+ PB.registerModuleAnalyses (MAM);
92+ PB.registerCGSCCAnalyses (CGAM);
93+ PB.registerFunctionAnalyses (FAM);
94+ PB.registerLoopAnalyses (LAM);
95+ PB.crossRegisterProxies (LAM, FAM, CGAM, MAM);
96+
97+ llvm::FunctionPassManager FPM;
98+ FPM.addPass (llvm::UnifyFunctionExitNodesPass ());
99+ FPM.run (const_cast <llvm::Function&>(fun), FAM);
100+ }
101+ }
102+ #else
80103 getUnifyExit (fun)->runOnFunction (const_cast <Function&>(fun));
81104 }
82105 }
@@ -86,6 +109,7 @@ class MergeFunctionRets : public ModulePass
86109 assert (!fn.isDeclaration () && " external function does not have DF" );
87110 return &getAnalysis<UnifyFunctionExitNodes>(const_cast <Function&>(fn));
88111 }
112+ #endif
89113};
90114
91115} // End namespace SVF
0 commit comments