[PATCH] D159410: [BOLT] skip CFG verification after the 'inst-lowering' Pass

Jiapeng Zhou via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 3 05:37:32 PDT 2023


Kepontry created this revision.
Kepontry added reviewers: maksfb, rafauler, hzq, Amir.
Kepontry added a project: bolt.
Herald added subscribers: treapster, ayermolo.
Herald added a project: All.
Kepontry requested review of this revision.
Herald added subscribers: llvm-commits, yota9.
Herald added a project: LLVM.

Since it's unsafe to use any CFG analysis after the “inst-lowering” Pass, we skip the “--verify-cfg” validation.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159410

Files:
  bolt/lib/Rewrite/BinaryPassManager.cpp


Index: bolt/lib/Rewrite/BinaryPassManager.cpp
===================================================================
--- bolt/lib/Rewrite/BinaryPassManager.cpp
+++ bolt/lib/Rewrite/BinaryPassManager.cpp
@@ -265,6 +265,7 @@
 
 void BinaryFunctionPassManager::runPasses() {
   auto &BFs = BC.getBinaryFunctions();
+  bool IsCFGSafe = true;
   for (size_t PassIdx = 0; PassIdx < Passes.size(); PassIdx++) {
     const std::pair<const bool, std::unique_ptr<BinaryFunctionPass>>
         &OptPassPair = Passes[PassIdx];
@@ -284,7 +285,9 @@
     callWithDynoStats([this, &Pass] { Pass->runOnFunctions(BC); }, BFs,
                       Pass->getName(), opts::DynoStatsAll, BC.isAArch64());
 
-    if (opts::VerifyCFG &&
+    if (strcmp(Pass->getName(), "inst-lowering") == 0)
+      IsCFGSafe = false;
+    if (opts::VerifyCFG && IsCFGSafe &&
         !std::accumulate(
             BFs.begin(), BFs.end(), true,
             [](const bool Valid,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159410.555630.patch
Type: text/x-patch
Size: 939 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230903/1a17e158/attachment.bin>


More information about the llvm-commits mailing list