File tree Expand file tree Collapse file tree 4 files changed +8
-11
lines changed Expand file tree Collapse file tree 4 files changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -1296,7 +1296,7 @@ class BinaryFunction {
1296
1296
// / Return true if the function body is non-contiguous.
1297
1297
bool isSplit () const { return isSimple () && getLayout ().isSplit (); }
1298
1298
1299
- bool shouldPreserveNops () const ;
1299
+ bool shouldPreserveNops () const { return PreserveNops; }
1300
1300
1301
1301
// / Return true if the function has exception handling tables.
1302
1302
bool hasEHRanges () const { return HasEHRanges; }
Original file line number Diff line number Diff line change @@ -4367,10 +4367,6 @@ MCInst *BinaryFunction::getInstructionAtOffset(uint64_t Offset) {
4367
4367
}
4368
4368
}
4369
4369
4370
- bool BinaryFunction::shouldPreserveNops () const {
4371
- return PreserveNops || opts::KeepNops;
4372
- }
4373
-
4374
4370
void BinaryFunction::printLoopInfo (raw_ostream &OS) const {
4375
4371
if (!opts::shouldPrint (*this ))
4376
4372
return ;
Original file line number Diff line number Diff line change @@ -72,6 +72,11 @@ static cl::opt<bool> JTFootprintReductionFlag(
72
72
" instructions at jump sites" ),
73
73
cl::cat(BoltOptCategory));
74
74
75
+ static cl::opt<bool >
76
+ KeepNops (" keep-nops" ,
77
+ cl::desc (" keep no-op instructions. By default they are removed." ),
78
+ cl::Hidden, cl::cat(BoltOptCategory));
79
+
75
80
cl::opt<bool > NeverPrint (" never-print" , cl::desc(" never print" ),
76
81
cl::ReallyHidden, cl::cat(BoltOptCategory));
77
82
@@ -359,7 +364,8 @@ void BinaryFunctionPassManager::runAllPasses(BinaryContext &BC) {
359
364
360
365
Manager.registerPass (std::make_unique<ShortenInstructions>(NeverPrint));
361
366
362
- Manager.registerPass (std::make_unique<RemoveNops>(NeverPrint));
367
+ Manager.registerPass (std::make_unique<RemoveNops>(NeverPrint),
368
+ !opts::KeepNops);
363
369
364
370
Manager.registerPass (std::make_unique<NormalizeCFG>(PrintNormalized));
365
371
Original file line number Diff line number Diff line change @@ -129,11 +129,6 @@ cl::opt<bool>
129
129
cl::desc (" instrument code to generate accurate profile data" ),
130
130
cl::cat(BoltOptCategory));
131
131
132
- cl::opt<bool >
133
- KeepNops (" keep-nops" ,
134
- cl::desc (" keep no-op instructions. By default they are removed." ),
135
- cl::Hidden, cl::cat(BoltOptCategory));
136
-
137
132
cl::opt<std::string>
138
133
OutputFilename (" o" ,
139
134
cl::desc (" <output file>" ),
You can’t perform that action at this time.
0 commit comments