[PATCH] D151510: [BOLT] Add skip-non-simple for boltdiff

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 27 10:29:35 PDT 2023


Amir updated this revision to Diff 526275.
Amir added a comment.

Filter non-simple funcs in BB and edge differences


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151510/new/

https://reviews.llvm.org/D151510

Files:
  bolt/lib/Rewrite/BoltDiff.cpp


Index: bolt/lib/Rewrite/BoltDiff.cpp
===================================================================
--- bolt/lib/Rewrite/BoltDiff.cpp
+++ bolt/lib/Rewrite/BoltDiff.cpp
@@ -83,6 +83,11 @@
              "collection time and sampling rate for this to make sense"),
     cl::cat(BoltDiffCategory));
 
+static cl::opt<bool> SkipNonSimple(
+    "skip-non-simple",
+    cl::desc("skip non-simple functions in reporting"),
+    cl::cat(BoltDiffCategory));
+
 } // end namespace opts
 
 namespace llvm {
@@ -428,8 +433,11 @@
          llvm::make_second_range(llvm::reverse(LargestDiffs))) {
       const double Score2 = getNormalizedScore(*BB2, RI2);
       const double Score1 = getNormalizedScore(*BBMap[BB2], RI1);
+      const BinaryFunction *Func = BBToFuncMap[BB2];
+      if (opts::SkipNonSimple && !Func->isSimple())
+        continue;
       outs() << "BB " << BB2->getName() << " from "
-             << BBToFuncMap[BB2]->getDemangledName()
+             << Func->getDemangledName()
              << "\n\tScore bin1 = " << format("%.4f", Score1 * 100.0)
              << "%\n\tScore bin2 = " << format("%.4f", Score2 * 100.0);
       outs() << "%\t(Difference: ";
@@ -460,9 +468,12 @@
       EdgeTy &Edge1 = EI.second;
       const double Score2 = std::get<2>(Edge2);
       const double Score1 = std::get<2>(Edge1);
+      const BinaryFunction *Func = BBToFuncMap[std::get<0>(Edge2)];
+      if (opts::SkipNonSimple && !Func->isSimple())
+        continue;
       outs() << "Edge (" << std::get<0>(Edge2)->getName() << " -> "
              << std::get<1>(Edge2)->getName() << ") in "
-             << BBToFuncMap[std::get<0>(Edge2)]->getDemangledName()
+             << Func->getDemangledName()
              << "\n\tScore bin1 = " << format("%.4f", Score1 * 100.0)
              << "%\n\tScore bin2 = " << format("%.4f", Score2 * 100.0);
       outs() << "%\t(Difference: ";
@@ -537,6 +548,8 @@
         Score2 = LTOAggregatedScore2[Iter2->second];
       if (Score1 == 0.0 || Score2 == 0.0)
         continue;
+      if (opts::SkipNonSimple && !Func1->isSimple() && !Func2->isSimple())
+        continue;
       LargestDiffs.insert(
           std::make_pair<>(std::abs(Score1 - Score2), MapEntry));
       ScoreMap[Func2] = std::make_pair<>(Score1, Score2);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151510.526275.patch
Type: text/x-patch
Size: 2268 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230527/38b0b110/attachment.bin>


More information about the llvm-commits mailing list