@@ -83,6 +83,11 @@ static cl::opt<bool> NormalizeByBin1(
8383 " collection time and sampling rate for this to make sense" ),
8484 cl::cat(BoltDiffCategory));
8585
86+ static cl::opt<bool >
87+ SkipNonSimple (" skip-non-simple" ,
88+ cl::desc (" skip non-simple functions in reporting" ),
89+ cl::ReallyHidden, cl::cat(BoltDiffCategory));
90+
8691} // end namespace opts
8792
8893namespace llvm {
@@ -428,8 +433,10 @@ class RewriteInstanceDiff {
428433 llvm::make_second_range (llvm::reverse (LargestDiffs))) {
429434 const double Score2 = getNormalizedScore (*BB2, RI2);
430435 const double Score1 = getNormalizedScore (*BBMap[BB2], RI1);
431- outs () << " BB " << BB2->getName () << " from "
432- << BBToFuncMap[BB2]->getDemangledName ()
436+ const BinaryFunction *Func = BBToFuncMap[BB2];
437+ if (opts::SkipNonSimple && !Func->isSimple ())
438+ continue ;
439+ outs () << " BB " << BB2->getName () << " from " << Func->getDemangledName ()
433440 << " \n\t Score bin1 = " << format (" %.4f" , Score1 * 100.0 )
434441 << " %\n\t Score bin2 = " << format (" %.4f" , Score2 * 100.0 );
435442 outs () << " %\t (Difference: " ;
@@ -460,9 +467,12 @@ class RewriteInstanceDiff {
460467 EdgeTy &Edge1 = EI.second ;
461468 const double Score2 = std::get<2 >(Edge2);
462469 const double Score1 = std::get<2 >(Edge1);
470+ const BinaryFunction *Func = BBToFuncMap[std::get<0 >(Edge2)];
471+ if (opts::SkipNonSimple && !Func->isSimple ())
472+ continue ;
463473 outs () << " Edge (" << std::get<0 >(Edge2)->getName () << " -> "
464474 << std::get<1 >(Edge2)->getName () << " ) in "
465- << BBToFuncMap[std::get< 0 >(Edge2)] ->getDemangledName ()
475+ << Func ->getDemangledName ()
466476 << " \n\t Score bin1 = " << format (" %.4f" , Score1 * 100.0 )
467477 << " %\n\t Score bin2 = " << format (" %.4f" , Score2 * 100.0 );
468478 outs () << " %\t (Difference: " ;
@@ -537,6 +547,8 @@ class RewriteInstanceDiff {
537547 Score2 = LTOAggregatedScore2[Iter2->second ];
538548 if (Score1 == 0.0 || Score2 == 0.0 )
539549 continue ;
550+ if (opts::SkipNonSimple && !Func1->isSimple () && !Func2->isSimple ())
551+ continue ;
540552 LargestDiffs.insert (
541553 std::make_pair<>(std::abs (Score1 - Score2), MapEntry));
542554 ScoreMap[Func2] = std::make_pair<>(Score1, Score2);
0 commit comments