[PATCH] D159410: [BOLT] Skip the validation of CFG after it is finalized

Jiapeng Zhou via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 15 08:16:31 PDT 2023


Kepontry updated this revision to Diff 556859.
Kepontry retitled this revision from "[BOLT] skip CFG verification after the 'inst-lowering' Pass" to "[BOLT] Skip the validation of CFG after it is finalized".
Kepontry edited the summary of this revision.

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

https://reviews.llvm.org/D159410

Files:
  bolt/lib/Core/BinaryFunction.cpp
  bolt/test/verify-cfg.test


Index: bolt/test/verify-cfg.test
===================================================================
--- /dev/null
+++ bolt/test/verify-cfg.test
@@ -0,0 +1,8 @@
+# Verify if the `--verify-cfg` option might produce incorrect alerts.
+
+REQUIRES: system-linux
+
+RUN: %clang %cflags %p/Inputs/hello.c -o %t -Wl,-q
+RUN: llvm-bolt %t -o %t.bolt --verify-cfg 2>&1 | FileCheck %s
+
+CHECK-NOT: BOLT-ERROR: Invalid CFG detected after pass {{.*}}
Index: bolt/lib/Core/BinaryFunction.cpp
===================================================================
--- bolt/lib/Core/BinaryFunction.cpp
+++ bolt/lib/Core/BinaryFunction.cpp
@@ -3156,6 +3156,11 @@
 }
 
 bool BinaryFunction::validateCFG() const {
+  // Skip the validation of CFG after it is finalized
+  if (CurrentState == State::CFG_Finalized) {
+    return true;
+  }
+
   bool Valid = true;
   for (BinaryBasicBlock *BB : BasicBlocks)
     Valid &= BB->validateSuccessorInvariants();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159410.556859.patch
Type: text/x-patch
Size: 936 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230915/29463632/attachment.bin>


More information about the llvm-commits mailing list