Index: include/llvm/Transforms/IPO/PassManagerBuilder.h =================================================================== --- include/llvm/Transforms/IPO/PassManagerBuilder.h +++ include/llvm/Transforms/IPO/PassManagerBuilder.h @@ -122,6 +122,7 @@ /// The module summary index to use for function importing. const ModuleSummaryIndex *ModuleSummary; + bool DisableGVNHoist; bool DisableTailCalls; bool DisableUnitAtATime; bool DisableUnrollLoops; Index: lib/Transforms/IPO/PassManagerBuilder.cpp =================================================================== --- lib/Transforms/IPO/PassManagerBuilder.cpp +++ lib/Transforms/IPO/PassManagerBuilder.cpp @@ -140,6 +140,7 @@ LibraryInfo = nullptr; Inliner = nullptr; ModuleSummary = nullptr; + DisableGVNHoist = false; DisableUnitAtATime = false; DisableUnrollLoops = false; BBVectorize = RunBBVectorization; @@ -232,7 +233,8 @@ FPM.add(createCFGSimplificationPass()); FPM.add(createSROAPass()); FPM.add(createEarlyCSEPass()); - FPM.add(createGVNHoistPass()); + if(!DisableGVNHoist) + FPM.add(createGVNHoistPass()); FPM.add(createLowerExpectIntrinsicPass()); }