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

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 30 15:24:25 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGc03e6511cf58: [BOLT] Add skip-non-simple for boltdiff (authored by Amir).

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::ReallyHidden, cl::cat(BoltDiffCategory));
+
 } // end namespace opts
 
 namespace llvm {
@@ -428,8 +433,10 @@
          llvm::make_second_range(llvm::reverse(LargestDiffs))) {
       const double Score2 = getNormalizedScore(*BB2, RI2);
       const double Score1 = getNormalizedScore(*BBMap[BB2], RI1);
-      outs() << "BB " << BB2->getName() << " from "
-             << BBToFuncMap[BB2]->getDemangledName()
+      const BinaryFunction *Func = BBToFuncMap[BB2];
+      if (opts::SkipNonSimple && !Func->isSimple())
+        continue;
+      outs() << "BB " << BB2->getName() << " from " << Func->getDemangledName()
              << "\n\tScore bin1 = " << format("%.4f", Score1 * 100.0)
              << "%\n\tScore bin2 = " << format("%.4f", Score2 * 100.0);
       outs() << "%\t(Difference: ";
@@ -460,9 +467,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 +547,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.526815.patch
Type: text/x-patch
Size: 2352 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230530/4e88fbc6/attachment.bin>


More information about the llvm-commits mailing list