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

Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 16 09:09:18 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG16fd8799800a: [BOLT] Skip the validation of CFG after it is finalized (authored by Kepontry, committed by hezuoqiang <hezuoqiang2 at huawei.com>).

Repository:
  rG LLVM Github Monorepo

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.556895.patch
Type: text/x-patch
Size: 929 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230916/802a1e2d/attachment.bin>


More information about the llvm-commits mailing list