diff --git a/llvm/include/llvm/Transforms/Scalar.h b/llvm/include/llvm/Transforms/Scalar.h --- a/llvm/include/llvm/Transforms/Scalar.h +++ b/llvm/include/llvm/Transforms/Scalar.h @@ -240,12 +240,9 @@ //===----------------------------------------------------------------------===// // // JumpThreading - Thread control through mult-pred/multi-succ blocks where some -// preds always go to some succ. If FreezeSelectCond is true, unfold the -// condition of a select that unfolds to branch. Thresholds other than minus one -// override the internal BB duplication default threshold. +// preds always go to some succ. // -FunctionPass *createJumpThreadingPass(bool FreezeSelectCond = false, - int Threshold = -1); +FunctionPass *createJumpThreadingPass(); //===----------------------------------------------------------------------===// // diff --git a/llvm/include/llvm/Transforms/Scalar/JumpThreading.h b/llvm/include/llvm/Transforms/Scalar/JumpThreading.h --- a/llvm/include/llvm/Transforms/Scalar/JumpThreading.h +++ b/llvm/include/llvm/Transforms/Scalar/JumpThreading.h @@ -92,10 +92,9 @@ unsigned BBDupThreshold; unsigned DefaultBBDupThreshold; - bool InsertFreezeWhenUnfoldingSelect; public: - JumpThreadingPass(bool InsertFreezeWhenUnfoldingSelect = true, int T = -1); + JumpThreadingPass(); // Glue for old PM. bool runImpl(Function &F, TargetLibraryInfo *TLI, TargetTransformInfo *TTI, diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -1617,7 +1617,7 @@ FPM.addPass(InstCombinePass()); invokePeepholeEPCallbacks(FPM, Level); - FPM.addPass(JumpThreadingPass(/*InsertFreezeWhenUnfoldingSelect*/ true)); + FPM.addPass(JumpThreadingPass()); // Do a post inline PGO instrumentation and use pass. This is a context // sensitive PGO pass. @@ -1701,7 +1701,7 @@ createModuleToPostOrderCGSCCPassAdaptor(OpenMPOptCGSCCPass())); invokePeepholeEPCallbacks(MainFPM, Level); - MainFPM.addPass(JumpThreadingPass(/*InsertFreezeWhenUnfoldingSelect*/ true)); + MainFPM.addPass(JumpThreadingPass()); MPM.addPass(createModuleToFunctionPassAdaptor(std::move(MainFPM), PTO.EagerlyInvalidateAnalyses)); diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp --- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp +++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp @@ -1011,7 +1011,7 @@ // The IPO passes may leave cruft around. Clean up after them. PM.add(createInstructionCombiningPass()); addExtensionsToPM(EP_Peephole, PM); - PM.add(createJumpThreadingPass(/*FreezeSelectCond*/ true)); + PM.add(createJumpThreadingPass()); // Break up allocas PM.add(createSROAPass()); @@ -1056,7 +1056,7 @@ addExtensionsToPM(EP_Peephole, PM); - PM.add(createJumpThreadingPass(/*FreezeSelectCond*/ true)); + PM.add(createJumpThreadingPass()); } void PassManagerBuilder::addLateLTOOptimizationPasses( diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp --- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp +++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp @@ -104,11 +104,6 @@ cl::desc("Print the LazyValueInfo cache after JumpThreading"), cl::init(false), cl::Hidden); -static cl::opt JumpThreadingFreezeSelectCond( - "jump-threading-freeze-select-cond", - cl::desc("Freeze the condition when unfolding select"), cl::init(true), - cl::Hidden); - static cl::opt ThreadAcrossLoopHeaders( "jump-threading-across-loop-headers", cl::desc("Allow JumpThreading to thread across loop headers, for testing"), @@ -138,8 +133,7 @@ public: static char ID; // Pass identification - JumpThreading(bool InsertFreezeWhenUnfoldingSelect = true, int T = -1) - : FunctionPass(ID), Impl(InsertFreezeWhenUnfoldingSelect, T) { + JumpThreading() : FunctionPass(ID), Impl() { initializeJumpThreadingPass(*PassRegistry::getPassRegistry()); } @@ -173,13 +167,10 @@ "Jump Threading", false, false) // Public interface to the Jump Threading pass -FunctionPass *llvm::createJumpThreadingPass(bool InsertFr, int Threshold) { - return new JumpThreading(InsertFr, Threshold); -} +FunctionPass *llvm::createJumpThreadingPass() { return new JumpThreading(); } -JumpThreadingPass::JumpThreadingPass(bool InsertFr, int T) { - InsertFreezeWhenUnfoldingSelect = JumpThreadingFreezeSelectCond | InsertFr; - DefaultBBDupThreshold = (T == -1) ? BBDuplicateThreshold : unsigned(T); +JumpThreadingPass::JumpThreadingPass() { + DefaultBBDupThreshold = BBDuplicateThreshold; } // Update branch probability information according to conditional @@ -2911,8 +2902,7 @@ continue; // Expand the select. Value *Cond = SI->getCondition(); - if (InsertFreezeWhenUnfoldingSelect && - !isGuaranteedNotToBeUndefOrPoison(Cond, nullptr, SI)) + if (!isGuaranteedNotToBeUndefOrPoison(Cond, nullptr, SI)) Cond = new FreezeInst(Cond, "cond.fr", SI); Instruction *Term = SplitBlockAndInsertIfThen(Cond, SI, false); BasicBlock *SplitBB = SI->getParent(); diff --git a/llvm/test/Transforms/JumpThreading/select-unfold-freeze.ll b/llvm/test/Transforms/JumpThreading/select-unfold-freeze.ll --- a/llvm/test/Transforms/JumpThreading/select-unfold-freeze.ll +++ b/llvm/test/Transforms/JumpThreading/select-unfold-freeze.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt -S -jump-threading-freeze-select-cond -jump-threading < %s | FileCheck %s +; RUN: opt -S -jump-threading < %s | FileCheck %s declare void @foo() declare void @bar()