[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 19:42:36 PDT 2023


Kepontry updated this revision to Diff 556888.

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,10 @@
 }
 
 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.556888.patch
Type: text/x-patch
Size: 929 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230916/0d7cc3f2/attachment.bin>


More information about the llvm-commits mailing list