[llvm] cfad8bf - [DomTree] Remove unnecessary check (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 22 02:41:37 PST 2023


Author: Nikita Popov
Date: 2023-11-22T11:41:26+01:00
New Revision: cfad8bf5098c051924040703ac3c6c2e65b21f6a

URL: https://github.com/llvm/llvm-project/commit/cfad8bf5098c051924040703ac3c6c2e65b21f6a
DIFF: https://github.com/llvm/llvm-project/commit/cfad8bf5098c051924040703ac3c6c2e65b21f6a.diff

LOG: [DomTree] Remove unnecessary check (NFC)

ReverseChildren is populated during runDFS() with reachable nodes
only. This check dates back to a time when this code used
inverse_children<> directly, which could indeed contain unreachable
nodes.

Added: 
    

Modified: 
    llvm/include/llvm/Support/GenericDomTreeConstruction.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/GenericDomTreeConstruction.h b/llvm/include/llvm/Support/GenericDomTreeConstruction.h
index d1adcad339c81b2..6564f98ab0234b0 100644
--- a/llvm/include/llvm/Support/GenericDomTreeConstruction.h
+++ b/llvm/include/llvm/Support/GenericDomTreeConstruction.h
@@ -286,8 +286,8 @@ struct SemiNCAInfo {
       // Initialize the semi dominator to point to the parent node.
       WInfo.Semi = WInfo.Parent;
       for (const auto &N : WInfo.ReverseChildren) {
-        if (NodeToInfo.count(N) == 0)  // Skip unreachable predecessors.
-          continue;
+        assert(NodeToInfo.contains(N) &&
+               "ReverseChildren should not contain unreachable predecessors");
 
         const TreeNodePtr TN = DT.getNode(N);
         // Skip predecessors whose level is above the subtree we are processing.


        


More information about the llvm-commits mailing list