@@ -120,23 +120,20 @@ static cl::opt<bool>
120
120
HoistCommon (" simplifycfg-hoist-common" , cl::Hidden, cl::init(true ),
121
121
cl::desc(" Hoist common instructions up to the parent block" ));
122
122
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" ));
128
130
129
131
static cl::opt<unsigned > HoistLoadsStoresWithCondFaultingThreshold (
130
132
" hoist-loads-stores-with-cond-faulting-threshold" , cl::Hidden, cl::init(6 ),
131
133
cl::desc(" Control the maximal conditional load/store that we are willing "
132
134
" to speculatively execute to eliminate conditional branch "
133
135
" (default = 6)" ));
134
136
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
-
140
137
static cl::opt<unsigned >
141
138
HoistCommonSkipLimit (" simplifycfg-hoist-common-skip-limit" , cl::Hidden,
142
139
cl::init (20 ),
@@ -1781,10 +1778,10 @@ static bool isSafeCheapLoadStore(const Instruction *I,
1781
1778
const TargetTransformInfo &TTI) {
1782
1779
// Not handle volatile or atomic.
1783
1780
if (auto *L = dyn_cast<LoadInst>(I)) {
1784
- if (!L->isSimple () || (DisableCloadCstore & 1 ) )
1781
+ if (!L->isSimple () || !HoistLoadsWithCondFaulting )
1785
1782
return false ;
1786
1783
} else if (auto *S = dyn_cast<StoreInst>(I)) {
1787
- if (!S->isSimple () || (DisableCloadCstore & 2 ) )
1784
+ if (!S->isSimple () || !HoistStoresWithCondFaulting )
1788
1785
return false ;
1789
1786
} else
1790
1787
return false ;
@@ -3224,8 +3221,7 @@ bool SimplifyCFGOpt::speculativelyExecuteBB(BranchInst *BI,
3224
3221
SmallVector<Instruction *, 4 > SpeculatedDbgIntrinsics;
3225
3222
3226
3223
unsigned SpeculatedInstructions = 0 ;
3227
- bool HoistLoadsStores = HoistLoadsStoresWithCondFaulting &&
3228
- Options.HoistLoadsStoresWithCondFaulting ;
3224
+ bool HoistLoadsStores = Options.HoistLoadsStoresWithCondFaulting ;
3229
3225
SmallVector<Instruction *, 2 > SpeculatedConditionalLoadsStores;
3230
3226
Value *SpeculatedStoreValue = nullptr ;
3231
3227
StoreInst *SpeculatedStore = nullptr ;
@@ -8033,8 +8029,7 @@ bool SimplifyCFGOpt::simplifyCondBranch(BranchInst *BI, IRBuilder<> &Builder) {
8033
8029
hoistCommonCodeFromSuccessors (BI, !Options.HoistCommonInsts ))
8034
8030
return requestResimplify ();
8035
8031
8036
- if (BI && HoistLoadsStoresWithCondFaulting &&
8037
- Options.HoistLoadsStoresWithCondFaulting &&
8032
+ if (BI && Options.HoistLoadsStoresWithCondFaulting &&
8038
8033
isProfitableToSpeculate (BI, std::nullopt, TTI)) {
8039
8034
SmallVector<Instruction *, 2 > SpeculatedConditionalLoadsStores;
8040
8035
auto CanSpeculateConditionalLoadsStores = [&]() {
0 commit comments