[DomTree] Provide a way to query if DFSInfo is valid#91251
[DomTree] Provide a way to query if DFSInfo is valid#91251
Conversation
Pass like GVNSink modify CFG use DFS numbers for storing basic blocks. 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.
|
@llvm/pr-subscribers-llvm-support Author: AdityaK (hiraditya) ChangesPass like GVNSink modify CFG use DFS numbers for storing basic blocks (See #90995). Full diff: https://github.com/llvm/llvm-project/pull/91251.diff 1 Files Affected:
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 {
|
|
I don't see why you'd need this; updateDFSNumbers short-circuits if the numbers are already up-to-date. |
Let's say i want to use DFSIn number, how do i know DFSIn number is valid calling updateDFSNumbers? The use case is:
One approach would be to keep a boolean (CFGModified for example) in the pass itself. but having this API will simplify it. |
And as I noted on the other review, calling |
makes sense. i should be able make it work without this API. |
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.