@@ -136,10 +136,10 @@ STATISTIC(NumThunksWritten, "Number of thunks generated");
136
136
STATISTIC (NumAliasesWritten, " Number of aliases generated" );
137
137
STATISTIC (NumDoubleWeak, " Number of new functions created" );
138
138
139
- static cl::opt<unsigned > NumFunctionsForSanityCheck (
140
- " mergefunc-sanity " ,
141
- cl::desc (" How many functions in module could be used for "
142
- " MergeFunctions pass sanity check. "
139
+ static cl::opt<unsigned > NumFunctionsForVerificationCheck (
140
+ " mergefunc-verify " ,
141
+ cl::desc (" How many functions in a module could be used for "
142
+ " MergeFunctions to pass a basic correctness check. "
143
143
" '0' disables this check. Works only with '-debug' key." ),
144
144
cl::init(0 ), cl::Hidden);
145
145
@@ -227,8 +227,8 @@ class MergeFunctions {
227
227
228
228
#ifndef NDEBUG
229
229
// / Checks the rules of order relation introduced among functions set.
230
- // / Returns true, if sanity check has been passed, and false if failed.
231
- bool doSanityCheck (std::vector<WeakTrackingVH> &Worklist);
230
+ // / Returns true, if check has been passed, and false if failed.
231
+ bool doFunctionalCheck (std::vector<WeakTrackingVH> &Worklist);
232
232
#endif
233
233
234
234
// / Insert a ComparableFunction into the FnTree, or merge it away if it's
@@ -327,12 +327,12 @@ PreservedAnalyses MergeFunctionsPass::run(Module &M,
327
327
}
328
328
329
329
#ifndef NDEBUG
330
- bool MergeFunctions::doSanityCheck (std::vector<WeakTrackingVH> &Worklist) {
331
- if (const unsigned Max = NumFunctionsForSanityCheck ) {
330
+ bool MergeFunctions::doFunctionalCheck (std::vector<WeakTrackingVH> &Worklist) {
331
+ if (const unsigned Max = NumFunctionsForVerificationCheck ) {
332
332
unsigned TripleNumber = 0 ;
333
333
bool Valid = true ;
334
334
335
- dbgs () << " MERGEFUNC-SANITY : Started for first " << Max << " functions.\n " ;
335
+ dbgs () << " MERGEFUNC-VERIFY : Started for first " << Max << " functions.\n " ;
336
336
337
337
unsigned i = 0 ;
338
338
for (std::vector<WeakTrackingVH>::iterator I = Worklist.begin (),
@@ -348,7 +348,7 @@ bool MergeFunctions::doSanityCheck(std::vector<WeakTrackingVH> &Worklist) {
348
348
349
349
// If F1 <= F2, then F2 >= F1, otherwise report failure.
350
350
if (Res1 != -Res2) {
351
- dbgs () << " MERGEFUNC-SANITY : Non-symmetric; triple: " << TripleNumber
351
+ dbgs () << " MERGEFUNC-VERIFY : Non-symmetric; triple: " << TripleNumber
352
352
<< " \n " ;
353
353
dbgs () << *F1 << ' \n ' << *F2 << ' \n ' ;
354
354
Valid = false ;
@@ -381,7 +381,7 @@ bool MergeFunctions::doSanityCheck(std::vector<WeakTrackingVH> &Worklist) {
381
381
}
382
382
383
383
if (!Transitive) {
384
- dbgs () << " MERGEFUNC-SANITY : Non-transitive; triple: "
384
+ dbgs () << " MERGEFUNC-VERIFY : Non-transitive; triple: "
385
385
<< TripleNumber << " \n " ;
386
386
dbgs () << " Res1, Res3, Res4: " << Res1 << " , " << Res3 << " , "
387
387
<< Res4 << " \n " ;
@@ -392,7 +392,7 @@ bool MergeFunctions::doSanityCheck(std::vector<WeakTrackingVH> &Worklist) {
392
392
}
393
393
}
394
394
395
- dbgs () << " MERGEFUNC-SANITY : " << (Valid ? " Passed." : " Failed." ) << " \n " ;
395
+ dbgs () << " MERGEFUNC-VERIFY : " << (Valid ? " Passed." : " Failed." ) << " \n " ;
396
396
return Valid;
397
397
}
398
398
return true ;
@@ -433,7 +433,7 @@ bool MergeFunctions::runOnModule(Module &M) {
433
433
std::vector<WeakTrackingVH> Worklist;
434
434
Deferred.swap (Worklist);
435
435
436
- LLVM_DEBUG (doSanityCheck (Worklist));
436
+ LLVM_DEBUG (doFunctionalCheck (Worklist));
437
437
438
438
LLVM_DEBUG (dbgs () << " size of module: " << M.size () << ' \n ' );
439
439
LLVM_DEBUG (dbgs () << " size of worklist: " << Worklist.size () << ' \n ' );
0 commit comments