[llvm] [DomTree] Provide a way to query if DFSInfo is valid (PR #91251)

via llvm-commits llvm-commits at lists.llvm.org
Mon May 6 11:36:02 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-support

Author: AdityaK (hiraditya)

<details>
<summary>Changes</summary>

Pass like GVNSink modify CFG use DFS numbers for storing basic blocks (See #<!-- -->90995).
Instead of updating DFS numbers after every modification to CFG,
it is more efficient to do lazily i.e., only when DFS numbers are going to be used by the pass.

---
Full diff: https://github.com/llvm/llvm-project/pull/91251.diff


1 Files Affected:

- (modified) llvm/include/llvm/Support/GenericDomTree.h (+2) 


``````````diff
diff --git a/llvm/include/llvm/Support/GenericDomTree.h b/llvm/include/llvm/Support/GenericDomTree.h
index 4fce9d8bfb2b68..91dd58f1b60873 100644
--- a/llvm/include/llvm/Support/GenericDomTree.h
+++ b/llvm/include/llvm/Support/GenericDomTree.h
@@ -328,6 +328,8 @@ class DominatorTreeBase {
   ///
   bool isPostDominator() const { return IsPostDominator; }
 
+  bool isDFSInfoValid() const { return DFSInfoValid; }
+
   /// compare - Return false if the other dominator tree base matches this
   /// dominator tree base. Otherwise return true.
   bool compare(const DominatorTreeBase &Other) const {

``````````

</details>


https://github.com/llvm/llvm-project/pull/91251


More information about the llvm-commits mailing list