@@ -120,23 +120,20 @@ static cl::opt<bool>
120120 HoistCommon (" simplifycfg-hoist-common" , cl::Hidden, cl::init(true ),
121121 cl::desc(" Hoist common instructions up to the parent block" ));
122122
123- static cl::opt<bool > HoistLoadsStoresWithCondFaulting (
124- " simplifycfg-hoist-loads-stores-with-cond-faulting" , cl::Hidden,
125- cl::init (true ),
126- cl::desc(" Hoist loads/stores if the target supports "
127- " conditional faulting" ));
123+ static cl::opt<bool > HoistLoadsWithCondFaulting (
124+ " simplifycfg-hoist-loads-with-cond-faulting" , cl::Hidden, cl::init(true ),
125+ cl::desc(" Hoist loads if the target supports conditional faulting" ));
126+
127+ static cl::opt<bool > HoistStoresWithCondFaulting (
128+ " simplifycfg-hoist-stores-with-cond-faulting" , cl::Hidden, cl::init(true ),
129+ cl::desc(" Hoist stores if the target supports conditional faulting" ));
128130
129131static cl::opt<unsigned > HoistLoadsStoresWithCondFaultingThreshold (
130132 " hoist-loads-stores-with-cond-faulting-threshold" , cl::Hidden, cl::init(6 ),
131133 cl::desc(" Control the maximal conditional load/store that we are willing "
132134 " to speculatively execute to eliminate conditional branch "
133135 " (default = 6)" ));
134136
135- static cl::opt<unsigned > DisableCloadCstore (
136- " disable-cload-cstore" , cl::Hidden, cl::init(0 ),
137- cl::desc(" Control to disable cond-faulting-load(1)/cond-faulting-store(2)"
138- " /all(3)" ));
139-
140137static cl::opt<unsigned >
141138 HoistCommonSkipLimit (" simplifycfg-hoist-common-skip-limit" , cl::Hidden,
142139 cl::init (20 ),
@@ -1781,10 +1778,10 @@ static bool isSafeCheapLoadStore(const Instruction *I,
17811778 const TargetTransformInfo &TTI) {
17821779 // Not handle volatile or atomic.
17831780 if (auto *L = dyn_cast<LoadInst>(I)) {
1784- if (!L->isSimple () || (DisableCloadCstore & 1 ) )
1781+ if (!L->isSimple () || !HoistLoadsWithCondFaulting )
17851782 return false ;
17861783 } else if (auto *S = dyn_cast<StoreInst>(I)) {
1787- if (!S->isSimple () || (DisableCloadCstore & 2 ) )
1784+ if (!S->isSimple () || !HoistStoresWithCondFaulting )
17881785 return false ;
17891786 } else
17901787 return false ;
@@ -3224,8 +3221,7 @@ bool SimplifyCFGOpt::speculativelyExecuteBB(BranchInst *BI,
32243221 SmallVector<Instruction *, 4 > SpeculatedDbgIntrinsics;
32253222
32263223 unsigned SpeculatedInstructions = 0 ;
3227- bool HoistLoadsStores = HoistLoadsStoresWithCondFaulting &&
3228- Options.HoistLoadsStoresWithCondFaulting ;
3224+ bool HoistLoadsStores = Options.HoistLoadsStoresWithCondFaulting ;
32293225 SmallVector<Instruction *, 2 > SpeculatedConditionalLoadsStores;
32303226 Value *SpeculatedStoreValue = nullptr ;
32313227 StoreInst *SpeculatedStore = nullptr ;
@@ -8033,8 +8029,7 @@ bool SimplifyCFGOpt::simplifyCondBranch(BranchInst *BI, IRBuilder<> &Builder) {
80338029 hoistCommonCodeFromSuccessors (BI, !Options.HoistCommonInsts ))
80348030 return requestResimplify ();
80358031
8036- if (BI && HoistLoadsStoresWithCondFaulting &&
8037- Options.HoistLoadsStoresWithCondFaulting &&
8032+ if (BI && Options.HoistLoadsStoresWithCondFaulting &&
80388033 isProfitableToSpeculate (BI, std::nullopt , TTI)) {
80398034 SmallVector<Instruction *, 2 > SpeculatedConditionalLoadsStores;
80408035 auto CanSpeculateConditionalLoadsStores = [&]() {
0 commit comments