Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/Support/GenericDomTreeConstruction.h
Line
Count
Source (jump to first uncovered line)
1
//===- GenericDomTreeConstruction.h - Dominator Calculation ------*- C++ -*-==//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
/// \file
9
///
10
/// Generic dominator tree construction - This file provides routines to
11
/// construct immediate dominator information for a flow-graph based on the
12
/// Semi-NCA algorithm described in this dissertation:
13
///
14
///   Linear-Time Algorithms for Dominators and Related Problems
15
///   Loukas Georgiadis, Princeton University, November 2005, pp. 21-23:
16
///   ftp://ftp.cs.princeton.edu/reports/2005/737.pdf
17
///
18
/// Semi-NCA algorithm runs in O(n^2) worst-case time but usually slightly
19
/// faster than Simple Lengauer-Tarjan in practice.
20
///
21
/// O(n^2) worst cases happen when the computation of nearest common ancestors
22
/// requires O(n) average time, which is very unlikely in real world. If this
23
/// ever turns out to be an issue, consider implementing a hybrid algorithm.
24
///
25
/// The file uses the Depth Based Search algorithm to perform incremental
26
/// updates (insertion and deletions). The implemented algorithm is based on
27
/// this publication:
28
///
29
///   An Experimental Study of Dynamic Dominators
30
///   Loukas Georgiadis, et al., April 12 2016, pp. 5-7, 9-10:
31
///   https://arxiv.org/pdf/1604.02711.pdf
32
///
33
//===----------------------------------------------------------------------===//
34
35
#ifndef LLVM_SUPPORT_GENERICDOMTREECONSTRUCTION_H
36
#define LLVM_SUPPORT_GENERICDOMTREECONSTRUCTION_H
37
38
#include <queue>
39
#include "llvm/ADT/ArrayRef.h"
40
#include "llvm/ADT/DenseSet.h"
41
#include "llvm/ADT/DepthFirstIterator.h"
42
#include "llvm/ADT/PointerIntPair.h"
43
#include "llvm/ADT/SmallPtrSet.h"
44
#include "llvm/Support/Debug.h"
45
#include "llvm/Support/GenericDomTree.h"
46
47
#define DEBUG_TYPE "dom-tree-builder"
48
49
namespace llvm {
50
namespace DomTreeBuilder {
51
52
template <typename DomTreeT>
53
struct SemiNCAInfo {
54
  using NodePtr = typename DomTreeT::NodePtr;
55
  using NodeT = typename DomTreeT::NodeType;
56
  using TreeNodePtr = DomTreeNodeBase<NodeT> *;
57
  using RootsT = decltype(DomTreeT::Roots);
58
  static constexpr bool IsPostDom = DomTreeT::IsPostDominator;
59
60
  // Information record used by Semi-NCA during tree construction.
61
  struct InfoRec {
62
    unsigned DFSNum = 0;
63
    unsigned Parent = 0;
64
    unsigned Semi = 0;
65
    NodePtr Label = nullptr;
66
    NodePtr IDom = nullptr;
67
    SmallVector<NodePtr, 2> ReverseChildren;
68
  };
69
70
  // Number to node mapping is 1-based. Initialize the mapping to start with
71
  // a dummy element.
72
  std::vector<NodePtr> NumToNode = {nullptr};
73
  DenseMap<NodePtr, InfoRec> NodeToInfo;
74
75
  using UpdateT = typename DomTreeT::UpdateType;
76
  using UpdateKind = typename DomTreeT::UpdateKind;
77
  struct BatchUpdateInfo {
78
    SmallVector<UpdateT, 4> Updates;
79
    using NodePtrAndKind = PointerIntPair<NodePtr, 1, UpdateKind>;
80
81
    // In order to be able to walk a CFG that is out of sync with the CFG
82
    // DominatorTree last knew about, use the list of updates to reconstruct
83
    // previous CFG versions of the current CFG. For each node, we store a set
84
    // of its virtually added/deleted future successors and predecessors.
85
    // Note that these children are from the future relative to what the
86
    // DominatorTree knows about -- using them to gets us some snapshot of the
87
    // CFG from the past (relative to the state of the CFG).
88
    DenseMap<NodePtr, SmallVector<NodePtrAndKind, 4>> FutureSuccessors;
89
    DenseMap<NodePtr, SmallVector<NodePtrAndKind, 4>> FuturePredecessors;
90
    // Remembers if the whole tree was recalculated at some point during the
91
    // current batch update.
92
    bool IsRecalculated = false;
93
  };
94
95
  BatchUpdateInfo *BatchUpdates;
96
  using BatchUpdatePtr = BatchUpdateInfo *;
97
98
  // If BUI is a nullptr, then there's no batch update in progress.
99
18.0M
  SemiNCAInfo(BatchUpdatePtr BUI) : BatchUpdates(BUI) {}
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::SemiNCAInfo(llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::BatchUpdateInfo*)
Line
Count
Source
99
2.61M
  SemiNCAInfo(BatchUpdatePtr BUI) : BatchUpdates(BUI) {}
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::SemiNCAInfo(llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::BatchUpdateInfo*)
Line
Count
Source
99
3.01M
  SemiNCAInfo(BatchUpdatePtr BUI) : BatchUpdates(BUI) {}
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::SemiNCAInfo(llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::BatchUpdateInfo*)
Line
Count
Source
99
11.2M
  SemiNCAInfo(BatchUpdatePtr BUI) : BatchUpdates(BUI) {}
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::SemiNCAInfo(llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::BatchUpdateInfo*)
Line
Count
Source
99
1.21M
  SemiNCAInfo(BatchUpdatePtr BUI) : BatchUpdates(BUI) {}
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::SemiNCAInfo(llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::BatchUpdateInfo*)
Line
Count
Source
99
28
  SemiNCAInfo(BatchUpdatePtr BUI) : BatchUpdates(BUI) {}
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, false> >::SemiNCAInfo(llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, false> >::BatchUpdateInfo*)
Line
Count
Source
99
8
  SemiNCAInfo(BatchUpdatePtr BUI) : BatchUpdates(BUI) {}
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, true> >::SemiNCAInfo(llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, true> >::BatchUpdateInfo*)
Line
Count
Source
99
214
  SemiNCAInfo(BatchUpdatePtr BUI) : BatchUpdates(BUI) {}
100
101
34.7k
  void clear() {
102
34.7k
    NumToNode = {nullptr}; // Restore to initial state with a dummy start node.
103
34.7k
    NodeToInfo.clear();
104
34.7k
    // Don't reset the pointer to BatchUpdateInfo here -- if there's an update
105
34.7k
    // in progress, we need this information to continue it.
106
34.7k
  }
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::clear()
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::clear()
Line
Count
Source
101
1.38k
  void clear() {
102
1.38k
    NumToNode = {nullptr}; // Restore to initial state with a dummy start node.
103
1.38k
    NodeToInfo.clear();
104
1.38k
    // Don't reset the pointer to BatchUpdateInfo here -- if there's an update
105
1.38k
    // in progress, we need this information to continue it.
106
1.38k
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::clear()
Line
Count
Source
101
4.71k
  void clear() {
102
4.71k
    NumToNode = {nullptr}; // Restore to initial state with a dummy start node.
103
4.71k
    NodeToInfo.clear();
104
4.71k
    // Don't reset the pointer to BatchUpdateInfo here -- if there's an update
105
4.71k
    // in progress, we need this information to continue it.
106
4.71k
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::clear()
Line
Count
Source
101
28.6k
  void clear() {
102
28.6k
    NumToNode = {nullptr}; // Restore to initial state with a dummy start node.
103
28.6k
    NodeToInfo.clear();
104
28.6k
    // Don't reset the pointer to BatchUpdateInfo here -- if there's an update
105
28.6k
    // in progress, we need this information to continue it.
106
28.6k
  }
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::clear()
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, true> >::clear()
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, false> >::clear()
107
108
  template <bool Inverse>
109
  struct ChildrenGetter {
110
    using ResultTy = SmallVector<NodePtr, 8>;
111
112
111M
    static ResultTy Get(NodePtr N, std::integral_constant<bool, false>) {
113
111M
      auto RChildren = reverse(children<NodePtr>(N));
114
111M
      return ResultTy(RChildren.begin(), RChildren.end());
115
111M
    }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::ChildrenGetter<false>::Get(llvm::MachineBasicBlock*, std::__1::integral_constant<bool, false>)
Line
Count
Source
112
12.0M
    static ResultTy Get(NodePtr N, std::integral_constant<bool, false>) {
113
12.0M
      auto RChildren = reverse(children<NodePtr>(N));
114
12.0M
      return ResultTy(RChildren.begin(), RChildren.end());
115
12.0M
    }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::ChildrenGetter<false>::Get(llvm::MachineBasicBlock*, std::__1::integral_constant<bool, false>)
Line
Count
Source
112
8.53M
    static ResultTy Get(NodePtr N, std::integral_constant<bool, false>) {
113
8.53M
      auto RChildren = reverse(children<NodePtr>(N));
114
8.53M
      return ResultTy(RChildren.begin(), RChildren.end());
115
8.53M
    }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::ChildrenGetter<false>::Get(llvm::BasicBlock*, std::__1::integral_constant<bool, false>)
Line
Count
Source
112
87.7M
    static ResultTy Get(NodePtr N, std::integral_constant<bool, false>) {
113
87.7M
      auto RChildren = reverse(children<NodePtr>(N));
114
87.7M
      return ResultTy(RChildren.begin(), RChildren.end());
115
87.7M
    }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::ChildrenGetter<false>::Get(llvm::BasicBlock*, std::__1::integral_constant<bool, false>)
Line
Count
Source
112
3.07M
    static ResultTy Get(NodePtr N, std::integral_constant<bool, false>) {
113
3.07M
      auto RChildren = reverse(children<NodePtr>(N));
114
3.07M
      return ResultTy(RChildren.begin(), RChildren.end());
115
3.07M
    }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::ChildrenGetter<false>::Get(llvm::VPBlockBase*, std::__1::integral_constant<bool, false>)
Line
Count
Source
112
135
    static ResultTy Get(NodePtr N, std::integral_constant<bool, false>) {
113
135
      auto RChildren = reverse(children<NodePtr>(N));
114
135
      return ResultTy(RChildren.begin(), RChildren.end());
115
135
    }
116
117
23.6M
    static ResultTy Get(NodePtr N, std::integral_constant<bool, true>) {
118
23.6M
      auto IChildren = inverse_children<NodePtr>(N);
119
23.6M
      return ResultTy(IChildren.begin(), IChildren.end());
120
23.6M
    }
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::ChildrenGetter<true>::Get(llvm::MachineBasicBlock*, std::__1::integral_constant<bool, true>)
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::ChildrenGetter<true>::Get(llvm::MachineBasicBlock*, std::__1::integral_constant<bool, true>)
Line
Count
Source
117
17.0M
    static ResultTy Get(NodePtr N, std::integral_constant<bool, true>) {
118
17.0M
      auto IChildren = inverse_children<NodePtr>(N);
119
17.0M
      return ResultTy(IChildren.begin(), IChildren.end());
120
17.0M
    }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::ChildrenGetter<true>::Get(llvm::BasicBlock*, std::__1::integral_constant<bool, true>)
Line
Count
Source
117
6.16M
    static ResultTy Get(NodePtr N, std::integral_constant<bool, true>) {
118
6.16M
      auto IChildren = inverse_children<NodePtr>(N);
119
6.16M
      return ResultTy(IChildren.begin(), IChildren.end());
120
6.16M
    }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::ChildrenGetter<true>::Get(llvm::BasicBlock*, std::__1::integral_constant<bool, true>)
Line
Count
Source
117
414k
    static ResultTy Get(NodePtr N, std::integral_constant<bool, true>) {
118
414k
      auto IChildren = inverse_children<NodePtr>(N);
119
414k
      return ResultTy(IChildren.begin(), IChildren.end());
120
414k
    }
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::ChildrenGetter<true>::Get(llvm::VPBlockBase*, std::__1::integral_constant<bool, true>)
121
122
    using Tag = std::integral_constant<bool, Inverse>;
123
124
    // The function below is the core part of the batch updater. It allows the
125
    // Depth Based Search algorithm to perform incremental updates in lockstep
126
    // with updates to the CFG. We emulated lockstep CFG updates by getting its
127
    // next snapshots by reverse-applying future updates.
128
134M
    static ResultTy Get(NodePtr N, BatchUpdatePtr BUI) {
129
134M
      ResultTy Res = Get(N, Tag());
130
134M
      // If there's no batch update in progress, simply return node's children.
131
134M
      if (!BUI) 
return Res111M
;
132
23.8M
133
23.8M
      // CFG children are actually its *most current* children, and we have to
134
23.8M
      // reverse-apply the future updates to get the node's children at the
135
23.8M
      // point in time the update was performed.
136
23.8M
      auto &FutureChildren = (Inverse != IsPostDom) ? 
BUI->FuturePredecessors402k
137
23.8M
                                                    : 
BUI->FutureSuccessors23.4M
;
138
23.8M
      auto FCIt = FutureChildren.find(N);
139
23.8M
      if (FCIt == FutureChildren.end()) 
return Res23.0M
;
140
796k
141
1.09M
      
for (auto ChildAndKind : FCIt->second)796k
{
142
1.09M
        const NodePtr Child = ChildAndKind.getPointer();
143
1.09M
        const UpdateKind UK = ChildAndKind.getInt();
144
1.09M
145
1.09M
        // Reverse-apply the future update.
146
1.09M
        if (UK == UpdateKind::Insert) {
147
431k
          // If there's an insertion in the future, it means that the edge must
148
431k
          // exist in the current CFG, but was not present in it before.
149
431k
          assert(llvm::find(Res, Child) != Res.end()
150
431k
                 && "Expected child not found in the CFG");
151
431k
          Res.erase(std::remove(Res.begin(), Res.end(), Child), Res.end());
152
431k
          LLVM_DEBUG(dbgs() << "\tHiding edge " << BlockNamePrinter(N) << " -> "
153
431k
                            << BlockNamePrinter(Child) << "\n");
154
659k
        } else {
155
659k
          // If there's an deletion in the future, it means that the edge cannot
156
659k
          // exist in the current CFG, but existed in it before.
157
659k
          assert(llvm::find(Res, Child) == Res.end() &&
158
659k
                 "Unexpected child found in the CFG");
159
659k
          LLVM_DEBUG(dbgs() << "\tShowing virtual edge " << BlockNamePrinter(N)
160
659k
                            << " -> " << BlockNamePrinter(Child) << "\n");
161
659k
          Res.push_back(Child);
162
659k
        }
163
1.09M
      }
164
796k
165
796k
      return Res;
166
796k
    }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::ChildrenGetter<false>::Get(llvm::MachineBasicBlock*, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::BatchUpdateInfo*)
Line
Count
Source
128
12.0M
    static ResultTy Get(NodePtr N, BatchUpdatePtr BUI) {
129
12.0M
      ResultTy Res = Get(N, Tag());
130
12.0M
      // If there's no batch update in progress, simply return node's children.
131
12.0M
      if (!BUI) 
return Res12.0M
;
132
3
133
3
      // CFG children are actually its *most current* children, and we have to
134
3
      // reverse-apply the future updates to get the node's children at the
135
3
      // point in time the update was performed.
136
3
      auto &FutureChildren = (Inverse != IsPostDom) ? 
BUI->FuturePredecessors0
137
3
                                                    : BUI->FutureSuccessors;
138
3
      auto FCIt = FutureChildren.find(N);
139
3
      if (FCIt == FutureChildren.end()) 
return Res0
;
140
3
141
3
      for (auto ChildAndKind : FCIt->second) {
142
0
        const NodePtr Child = ChildAndKind.getPointer();
143
0
        const UpdateKind UK = ChildAndKind.getInt();
144
0
145
0
        // Reverse-apply the future update.
146
0
        if (UK == UpdateKind::Insert) {
147
0
          // If there's an insertion in the future, it means that the edge must
148
0
          // exist in the current CFG, but was not present in it before.
149
0
          assert(llvm::find(Res, Child) != Res.end()
150
0
                 && "Expected child not found in the CFG");
151
0
          Res.erase(std::remove(Res.begin(), Res.end(), Child), Res.end());
152
0
          LLVM_DEBUG(dbgs() << "\tHiding edge " << BlockNamePrinter(N) << " -> "
153
0
                            << BlockNamePrinter(Child) << "\n");
154
0
        } else {
155
0
          // If there's an deletion in the future, it means that the edge cannot
156
0
          // exist in the current CFG, but existed in it before.
157
0
          assert(llvm::find(Res, Child) == Res.end() &&
158
0
                 "Unexpected child found in the CFG");
159
0
          LLVM_DEBUG(dbgs() << "\tShowing virtual edge " << BlockNamePrinter(N)
160
0
                            << " -> " << BlockNamePrinter(Child) << "\n");
161
0
          Res.push_back(Child);
162
0
        }
163
0
      }
164
3
165
3
      return Res;
166
3
    }
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::ChildrenGetter<true>::Get(llvm::MachineBasicBlock*, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::BatchUpdateInfo*)
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::ChildrenGetter<false>::Get(llvm::MachineBasicBlock*, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::BatchUpdateInfo*)
Line
Count
Source
128
8.53M
    static ResultTy Get(NodePtr N, BatchUpdatePtr BUI) {
129
8.53M
      ResultTy Res = Get(N, Tag());
130
8.53M
      // If there's no batch update in progress, simply return node's children.
131
8.53M
      if (
!BUI8.53M
) return Res;
132
18.4E
133
18.4E
      // CFG children are actually its *most current* children, and we have to
134
18.4E
      // reverse-apply the future updates to get the node's children at the
135
18.4E
      // point in time the update was performed.
136
18.4E
      auto &FutureChildren = (Inverse != IsPostDom) ? 
BUI->FuturePredecessors0
137
18.4E
                                                    : BUI->FutureSuccessors;
138
18.4E
      auto FCIt = FutureChildren.find(N);
139
18.4E
      if (FCIt == FutureChildren.end()) 
return Res0
;
140
18.4E
141
18.4E
      for (auto ChildAndKind : FCIt->second) {
142
0
        const NodePtr Child = ChildAndKind.getPointer();
143
0
        const UpdateKind UK = ChildAndKind.getInt();
144
0
145
0
        // Reverse-apply the future update.
146
0
        if (UK == UpdateKind::Insert) {
147
0
          // If there's an insertion in the future, it means that the edge must
148
0
          // exist in the current CFG, but was not present in it before.
149
0
          assert(llvm::find(Res, Child) != Res.end()
150
0
                 && "Expected child not found in the CFG");
151
0
          Res.erase(std::remove(Res.begin(), Res.end(), Child), Res.end());
152
0
          LLVM_DEBUG(dbgs() << "\tHiding edge " << BlockNamePrinter(N) << " -> "
153
0
                            << BlockNamePrinter(Child) << "\n");
154
0
        } else {
155
0
          // If there's an deletion in the future, it means that the edge cannot
156
0
          // exist in the current CFG, but existed in it before.
157
0
          assert(llvm::find(Res, Child) == Res.end() &&
158
0
                 "Unexpected child found in the CFG");
159
0
          LLVM_DEBUG(dbgs() << "\tShowing virtual edge " << BlockNamePrinter(N)
160
0
                            << " -> " << BlockNamePrinter(Child) << "\n");
161
0
          Res.push_back(Child);
162
0
        }
163
0
      }
164
18.4E
165
18.4E
      return Res;
166
18.4E
    }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::ChildrenGetter<true>::Get(llvm::MachineBasicBlock*, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::BatchUpdateInfo*)
Line
Count
Source
128
17.0M
    static ResultTy Get(NodePtr N, BatchUpdatePtr BUI) {
129
17.0M
      ResultTy Res = Get(N, Tag());
130
17.0M
      // If there's no batch update in progress, simply return node's children.
131
17.0M
      if (!BUI) 
return Res17.0M
;
132
8
133
8
      // CFG children are actually its *most current* children, and we have to
134
8
      // reverse-apply the future updates to get the node's children at the
135
8
      // point in time the update was performed.
136
8
      auto &FutureChildren = (Inverse != IsPostDom) ? 
BUI->FuturePredecessors0
137
8
                                                    : BUI->FutureSuccessors;
138
8
      auto FCIt = FutureChildren.find(N);
139
8
      if (FCIt == FutureChildren.end()) 
return Res0
;
140
8
141
8
      for (auto ChildAndKind : FCIt->second) {
142
0
        const NodePtr Child = ChildAndKind.getPointer();
143
0
        const UpdateKind UK = ChildAndKind.getInt();
144
0
145
0
        // Reverse-apply the future update.
146
0
        if (UK == UpdateKind::Insert) {
147
0
          // If there's an insertion in the future, it means that the edge must
148
0
          // exist in the current CFG, but was not present in it before.
149
0
          assert(llvm::find(Res, Child) != Res.end()
150
0
                 && "Expected child not found in the CFG");
151
0
          Res.erase(std::remove(Res.begin(), Res.end(), Child), Res.end());
152
0
          LLVM_DEBUG(dbgs() << "\tHiding edge " << BlockNamePrinter(N) << " -> "
153
0
                            << BlockNamePrinter(Child) << "\n");
154
0
        } else {
155
0
          // If there's an deletion in the future, it means that the edge cannot
156
0
          // exist in the current CFG, but existed in it before.
157
0
          assert(llvm::find(Res, Child) == Res.end() &&
158
0
                 "Unexpected child found in the CFG");
159
0
          LLVM_DEBUG(dbgs() << "\tShowing virtual edge " << BlockNamePrinter(N)
160
0
                            << " -> " << BlockNamePrinter(Child) << "\n");
161
0
          Res.push_back(Child);
162
0
        }
163
0
      }
164
8
165
8
      return Res;
166
8
    }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::ChildrenGetter<false>::Get(llvm::BasicBlock*, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::BatchUpdateInfo*)
Line
Count
Source
128
87.7M
    static ResultTy Get(NodePtr N, BatchUpdatePtr BUI) {
129
87.7M
      ResultTy Res = Get(N, Tag());
130
87.7M
      // If there's no batch update in progress, simply return node's children.
131
87.7M
      if (!BUI) 
return Res64.2M
;
132
23.4M
133
23.4M
      // CFG children are actually its *most current* children, and we have to
134
23.4M
      // reverse-apply the future updates to get the node's children at the
135
23.4M
      // point in time the update was performed.
136
23.4M
      auto &FutureChildren = (Inverse != IsPostDom) ? 
BUI->FuturePredecessors0
137
23.4M
                                                    : BUI->FutureSuccessors;
138
23.4M
      auto FCIt = FutureChildren.find(N);
139
23.4M
      if (FCIt == FutureChildren.end()) 
return Res22.7M
;
140
766k
141
1.04M
      
for (auto ChildAndKind : FCIt->second)766k
{
142
1.04M
        const NodePtr Child = ChildAndKind.getPointer();
143
1.04M
        const UpdateKind UK = ChildAndKind.getInt();
144
1.04M
145
1.04M
        // Reverse-apply the future update.
146
1.04M
        if (UK == UpdateKind::Insert) {
147
408k
          // If there's an insertion in the future, it means that the edge must
148
408k
          // exist in the current CFG, but was not present in it before.
149
408k
          assert(llvm::find(Res, Child) != Res.end()
150
408k
                 && "Expected child not found in the CFG");
151
408k
          Res.erase(std::remove(Res.begin(), Res.end(), Child), Res.end());
152
408k
          LLVM_DEBUG(dbgs() << "\tHiding edge " << BlockNamePrinter(N) << " -> "
153
408k
                            << BlockNamePrinter(Child) << "\n");
154
640k
        } else {
155
640k
          // If there's an deletion in the future, it means that the edge cannot
156
640k
          // exist in the current CFG, but existed in it before.
157
640k
          assert(llvm::find(Res, Child) == Res.end() &&
158
640k
                 "Unexpected child found in the CFG");
159
640k
          LLVM_DEBUG(dbgs() << "\tShowing virtual edge " << BlockNamePrinter(N)
160
640k
                            << " -> " << BlockNamePrinter(Child) << "\n");
161
640k
          Res.push_back(Child);
162
640k
        }
163
1.04M
      }
164
766k
165
766k
      return Res;
166
766k
    }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::ChildrenGetter<false>::Get(llvm::BasicBlock*, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::BatchUpdateInfo*)
Line
Count
Source
128
3.07M
    static ResultTy Get(NodePtr N, BatchUpdatePtr BUI) {
129
3.07M
      ResultTy Res = Get(N, Tag());
130
3.07M
      // If there's no batch update in progress, simply return node's children.
131
3.07M
      if (!BUI) 
return Res3.06M
;
132
804
133
804
      // CFG children are actually its *most current* children, and we have to
134
804
      // reverse-apply the future updates to get the node's children at the
135
804
      // point in time the update was performed.
136
804
      auto &FutureChildren = (Inverse != IsPostDom) ? 
BUI->FuturePredecessors794
137
804
                                                    : 
BUI->FutureSuccessors10
;
138
804
      auto FCIt = FutureChildren.find(N);
139
804
      if (FCIt == FutureChildren.end()) 
return Res493
;
140
311
141
441
      
for (auto ChildAndKind : FCIt->second)311
{
142
441
        const NodePtr Child = ChildAndKind.getPointer();
143
441
        const UpdateKind UK = ChildAndKind.getInt();
144
441
145
441
        // Reverse-apply the future update.
146
441
        if (UK == UpdateKind::Insert) {
147
272
          // If there's an insertion in the future, it means that the edge must
148
272
          // exist in the current CFG, but was not present in it before.
149
272
          assert(llvm::find(Res, Child) != Res.end()
150
272
                 && "Expected child not found in the CFG");
151
272
          Res.erase(std::remove(Res.begin(), Res.end(), Child), Res.end());
152
272
          LLVM_DEBUG(dbgs() << "\tHiding edge " << BlockNamePrinter(N) << " -> "
153
272
                            << BlockNamePrinter(Child) << "\n");
154
272
        } else {
155
169
          // If there's an deletion in the future, it means that the edge cannot
156
169
          // exist in the current CFG, but existed in it before.
157
169
          assert(llvm::find(Res, Child) == Res.end() &&
158
169
                 "Unexpected child found in the CFG");
159
169
          LLVM_DEBUG(dbgs() << "\tShowing virtual edge " << BlockNamePrinter(N)
160
169
                            << " -> " << BlockNamePrinter(Child) << "\n");
161
169
          Res.push_back(Child);
162
169
        }
163
441
      }
164
311
165
311
      return Res;
166
311
    }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::ChildrenGetter<true>::Get(llvm::BasicBlock*, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::BatchUpdateInfo*)
Line
Count
Source
128
6.16M
    static ResultTy Get(NodePtr N, BatchUpdatePtr BUI) {
129
6.16M
      ResultTy Res = Get(N, Tag());
130
6.16M
      // If there's no batch update in progress, simply return node's children.
131
6.16M
      if (!BUI) 
return Res6.16M
;
132
540
133
540
      // CFG children are actually its *most current* children, and we have to
134
540
      // reverse-apply the future updates to get the node's children at the
135
540
      // point in time the update was performed.
136
540
      auto &FutureChildren = (Inverse != IsPostDom) ? 
BUI->FuturePredecessors0
137
540
                                                    : BUI->FutureSuccessors;
138
540
      auto FCIt = FutureChildren.find(N);
139
540
      if (FCIt == FutureChildren.end()) 
return Res392
;
140
148
141
237
      
for (auto ChildAndKind : FCIt->second)148
{
142
237
        const NodePtr Child = ChildAndKind.getPointer();
143
237
        const UpdateKind UK = ChildAndKind.getInt();
144
237
145
237
        // Reverse-apply the future update.
146
237
        if (UK == UpdateKind::Insert) {
147
127
          // If there's an insertion in the future, it means that the edge must
148
127
          // exist in the current CFG, but was not present in it before.
149
127
          assert(llvm::find(Res, Child) != Res.end()
150
127
                 && "Expected child not found in the CFG");
151
127
          Res.erase(std::remove(Res.begin(), Res.end(), Child), Res.end());
152
127
          LLVM_DEBUG(dbgs() << "\tHiding edge " << BlockNamePrinter(N) << " -> "
153
127
                            << BlockNamePrinter(Child) << "\n");
154
127
        } else {
155
110
          // If there's an deletion in the future, it means that the edge cannot
156
110
          // exist in the current CFG, but existed in it before.
157
110
          assert(llvm::find(Res, Child) == Res.end() &&
158
110
                 "Unexpected child found in the CFG");
159
110
          LLVM_DEBUG(dbgs() << "\tShowing virtual edge " << BlockNamePrinter(N)
160
110
                            << " -> " << BlockNamePrinter(Child) << "\n");
161
110
          Res.push_back(Child);
162
110
        }
163
237
      }
164
148
165
148
      return Res;
166
148
    }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::ChildrenGetter<true>::Get(llvm::BasicBlock*, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::BatchUpdateInfo*)
Line
Count
Source
128
414k
    static ResultTy Get(NodePtr N, BatchUpdatePtr BUI) {
129
414k
      ResultTy Res = Get(N, Tag());
130
414k
      // If there's no batch update in progress, simply return node's children.
131
414k
      if (!BUI) 
return Res12.2k
;
132
402k
133
402k
      // CFG children are actually its *most current* children, and we have to
134
402k
      // reverse-apply the future updates to get the node's children at the
135
402k
      // point in time the update was performed.
136
402k
      auto &FutureChildren = (Inverse != IsPostDom) ? BUI->FuturePredecessors
137
402k
                                                    : 
BUI->FutureSuccessors0
;
138
402k
      auto FCIt = FutureChildren.find(N);
139
402k
      if (FCIt == FutureChildren.end()) 
return Res372k
;
140
29.1k
141
42.2k
      
for (auto ChildAndKind : FCIt->second)29.1k
{
142
42.2k
        const NodePtr Child = ChildAndKind.getPointer();
143
42.2k
        const UpdateKind UK = ChildAndKind.getInt();
144
42.2k
145
42.2k
        // Reverse-apply the future update.
146
42.2k
        if (UK == UpdateKind::Insert) {
147
23.2k
          // If there's an insertion in the future, it means that the edge must
148
23.2k
          // exist in the current CFG, but was not present in it before.
149
23.2k
          assert(llvm::find(Res, Child) != Res.end()
150
23.2k
                 && "Expected child not found in the CFG");
151
23.2k
          Res.erase(std::remove(Res.begin(), Res.end(), Child), Res.end());
152
23.2k
          LLVM_DEBUG(dbgs() << "\tHiding edge " << BlockNamePrinter(N) << " -> "
153
23.2k
                            << BlockNamePrinter(Child) << "\n");
154
23.2k
        } else {
155
18.9k
          // If there's an deletion in the future, it means that the edge cannot
156
18.9k
          // exist in the current CFG, but existed in it before.
157
18.9k
          assert(llvm::find(Res, Child) == Res.end() &&
158
18.9k
                 "Unexpected child found in the CFG");
159
18.9k
          LLVM_DEBUG(dbgs() << "\tShowing virtual edge " << BlockNamePrinter(N)
160
18.9k
                            << " -> " << BlockNamePrinter(Child) << "\n");
161
18.9k
          Res.push_back(Child);
162
18.9k
        }
163
42.2k
      }
164
29.1k
165
29.1k
      return Res;
166
29.1k
    }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::ChildrenGetter<false>::Get(llvm::VPBlockBase*, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::BatchUpdateInfo*)
Line
Count
Source
128
135
    static ResultTy Get(NodePtr N, BatchUpdatePtr BUI) {
129
135
      ResultTy Res = Get(N, Tag());
130
135
      // If there's no batch update in progress, simply return node's children.
131
135
      if (!BUI) return Res;
132
0
133
0
      // CFG children are actually its *most current* children, and we have to
134
0
      // reverse-apply the future updates to get the node's children at the
135
0
      // point in time the update was performed.
136
0
      auto &FutureChildren = (Inverse != IsPostDom) ? BUI->FuturePredecessors
137
0
                                                    : BUI->FutureSuccessors;
138
0
      auto FCIt = FutureChildren.find(N);
139
0
      if (FCIt == FutureChildren.end()) return Res;
140
0
141
0
      for (auto ChildAndKind : FCIt->second) {
142
0
        const NodePtr Child = ChildAndKind.getPointer();
143
0
        const UpdateKind UK = ChildAndKind.getInt();
144
0
145
0
        // Reverse-apply the future update.
146
0
        if (UK == UpdateKind::Insert) {
147
0
          // If there's an insertion in the future, it means that the edge must
148
0
          // exist in the current CFG, but was not present in it before.
149
0
          assert(llvm::find(Res, Child) != Res.end()
150
0
                 && "Expected child not found in the CFG");
151
0
          Res.erase(std::remove(Res.begin(), Res.end(), Child), Res.end());
152
0
          LLVM_DEBUG(dbgs() << "\tHiding edge " << BlockNamePrinter(N) << " -> "
153
0
                            << BlockNamePrinter(Child) << "\n");
154
0
        } else {
155
0
          // If there's an deletion in the future, it means that the edge cannot
156
0
          // exist in the current CFG, but existed in it before.
157
0
          assert(llvm::find(Res, Child) == Res.end() &&
158
0
                 "Unexpected child found in the CFG");
159
0
          LLVM_DEBUG(dbgs() << "\tShowing virtual edge " << BlockNamePrinter(N)
160
0
                            << " -> " << BlockNamePrinter(Child) << "\n");
161
0
          Res.push_back(Child);
162
0
        }
163
0
      }
164
0
165
0
      return Res;
166
0
    }
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::ChildrenGetter<true>::Get(llvm::VPBlockBase*, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::BatchUpdateInfo*)
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, false> >::ChildrenGetter<false>::Get(clang::CFGBlock*, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, false> >::BatchUpdateInfo*)
Line
Count
Source
128
66
    static ResultTy Get(NodePtr N, BatchUpdatePtr BUI) {
129
66
      ResultTy Res = Get(N, Tag());
130
66
      // If there's no batch update in progress, simply return node's children.
131
66
      if (!BUI) return Res;
132
0
133
0
      // CFG children are actually its *most current* children, and we have to
134
0
      // reverse-apply the future updates to get the node's children at the
135
0
      // point in time the update was performed.
136
0
      auto &FutureChildren = (Inverse != IsPostDom) ? BUI->FuturePredecessors
137
0
                                                    : BUI->FutureSuccessors;
138
0
      auto FCIt = FutureChildren.find(N);
139
0
      if (FCIt == FutureChildren.end()) return Res;
140
0
141
0
      for (auto ChildAndKind : FCIt->second) {
142
0
        const NodePtr Child = ChildAndKind.getPointer();
143
0
        const UpdateKind UK = ChildAndKind.getInt();
144
0
145
0
        // Reverse-apply the future update.
146
0
        if (UK == UpdateKind::Insert) {
147
0
          // If there's an insertion in the future, it means that the edge must
148
0
          // exist in the current CFG, but was not present in it before.
149
0
          assert(llvm::find(Res, Child) != Res.end()
150
0
                 && "Expected child not found in the CFG");
151
0
          Res.erase(std::remove(Res.begin(), Res.end(), Child), Res.end());
152
0
          LLVM_DEBUG(dbgs() << "\tHiding edge " << BlockNamePrinter(N) << " -> "
153
0
                            << BlockNamePrinter(Child) << "\n");
154
0
        } else {
155
0
          // If there's an deletion in the future, it means that the edge cannot
156
0
          // exist in the current CFG, but existed in it before.
157
0
          assert(llvm::find(Res, Child) == Res.end() &&
158
0
                 "Unexpected child found in the CFG");
159
0
          LLVM_DEBUG(dbgs() << "\tShowing virtual edge " << BlockNamePrinter(N)
160
0
                            << " -> " << BlockNamePrinter(Child) << "\n");
161
0
          Res.push_back(Child);
162
0
        }
163
0
      }
164
0
165
0
      return Res;
166
0
    }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, true> >::ChildrenGetter<false>::Get(clang::CFGBlock*, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, true> >::BatchUpdateInfo*)
Line
Count
Source
128
549
    static ResultTy Get(NodePtr N, BatchUpdatePtr BUI) {
129
549
      ResultTy Res = Get(N, Tag());
130
549
      // If there's no batch update in progress, simply return node's children.
131
549
      if (!BUI) return Res;
132
0
133
0
      // CFG children are actually its *most current* children, and we have to
134
0
      // reverse-apply the future updates to get the node's children at the
135
0
      // point in time the update was performed.
136
0
      auto &FutureChildren = (Inverse != IsPostDom) ? BUI->FuturePredecessors
137
0
                                                    : BUI->FutureSuccessors;
138
0
      auto FCIt = FutureChildren.find(N);
139
0
      if (FCIt == FutureChildren.end()) return Res;
140
0
141
0
      for (auto ChildAndKind : FCIt->second) {
142
0
        const NodePtr Child = ChildAndKind.getPointer();
143
0
        const UpdateKind UK = ChildAndKind.getInt();
144
0
145
0
        // Reverse-apply the future update.
146
0
        if (UK == UpdateKind::Insert) {
147
0
          // If there's an insertion in the future, it means that the edge must
148
0
          // exist in the current CFG, but was not present in it before.
149
0
          assert(llvm::find(Res, Child) != Res.end()
150
0
                 && "Expected child not found in the CFG");
151
0
          Res.erase(std::remove(Res.begin(), Res.end(), Child), Res.end());
152
0
          LLVM_DEBUG(dbgs() << "\tHiding edge " << BlockNamePrinter(N) << " -> "
153
0
                            << BlockNamePrinter(Child) << "\n");
154
0
        } else {
155
0
          // If there's an deletion in the future, it means that the edge cannot
156
0
          // exist in the current CFG, but existed in it before.
157
0
          assert(llvm::find(Res, Child) == Res.end() &&
158
0
                 "Unexpected child found in the CFG");
159
0
          LLVM_DEBUG(dbgs() << "\tShowing virtual edge " << BlockNamePrinter(N)
160
0
                            << " -> " << BlockNamePrinter(Child) << "\n");
161
0
          Res.push_back(Child);
162
0
        }
163
0
      }
164
0
165
0
      return Res;
166
0
    }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, true> >::ChildrenGetter<true>::Get(clang::CFGBlock*, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, true> >::BatchUpdateInfo*)
Line
Count
Source
128
1.09k
    static ResultTy Get(NodePtr N, BatchUpdatePtr BUI) {
129
1.09k
      ResultTy Res = Get(N, Tag());
130
1.09k
      // If there's no batch update in progress, simply return node's children.
131
1.09k
      if (!BUI) return Res;
132
0
133
0
      // CFG children are actually its *most current* children, and we have to
134
0
      // reverse-apply the future updates to get the node's children at the
135
0
      // point in time the update was performed.
136
0
      auto &FutureChildren = (Inverse != IsPostDom) ? BUI->FuturePredecessors
137
0
                                                    : BUI->FutureSuccessors;
138
0
      auto FCIt = FutureChildren.find(N);
139
0
      if (FCIt == FutureChildren.end()) return Res;
140
0
141
0
      for (auto ChildAndKind : FCIt->second) {
142
0
        const NodePtr Child = ChildAndKind.getPointer();
143
0
        const UpdateKind UK = ChildAndKind.getInt();
144
0
145
0
        // Reverse-apply the future update.
146
0
        if (UK == UpdateKind::Insert) {
147
0
          // If there's an insertion in the future, it means that the edge must
148
0
          // exist in the current CFG, but was not present in it before.
149
0
          assert(llvm::find(Res, Child) != Res.end()
150
0
                 && "Expected child not found in the CFG");
151
0
          Res.erase(std::remove(Res.begin(), Res.end(), Child), Res.end());
152
0
          LLVM_DEBUG(dbgs() << "\tHiding edge " << BlockNamePrinter(N) << " -> "
153
0
                            << BlockNamePrinter(Child) << "\n");
154
0
        } else {
155
0
          // If there's an deletion in the future, it means that the edge cannot
156
0
          // exist in the current CFG, but existed in it before.
157
0
          assert(llvm::find(Res, Child) == Res.end() &&
158
0
                 "Unexpected child found in the CFG");
159
0
          LLVM_DEBUG(dbgs() << "\tShowing virtual edge " << BlockNamePrinter(N)
160
0
                            << " -> " << BlockNamePrinter(Child) << "\n");
161
0
          Res.push_back(Child);
162
0
        }
163
0
      }
164
0
165
0
      return Res;
166
0
    }
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, false> >::ChildrenGetter<true>::Get(clang::CFGBlock*, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, false> >::BatchUpdateInfo*)
167
  };
168
169
74.8M
  NodePtr getIDom(NodePtr BB) const {
170
74.8M
    auto InfoIt = NodeToInfo.find(BB);
171
74.8M
    if (InfoIt == NodeToInfo.end()) 
return nullptr0
;
172
74.8M
173
74.8M
    return InfoIt->second.IDom;
174
74.8M
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::getIDom(llvm::MachineBasicBlock*) const
Line
Count
Source
169
9.38M
  NodePtr getIDom(NodePtr BB) const {
170
9.38M
    auto InfoIt = NodeToInfo.find(BB);
171
9.38M
    if (InfoIt == NodeToInfo.end()) 
return nullptr0
;
172
9.38M
173
9.38M
    return InfoIt->second.IDom;
174
9.38M
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::getIDom(llvm::MachineBasicBlock*) const
Line
Count
Source
169
8.52M
  NodePtr getIDom(NodePtr BB) const {
170
8.52M
    auto InfoIt = NodeToInfo.find(BB);
171
8.52M
    if (InfoIt == NodeToInfo.end()) 
return nullptr0
;
172
8.52M
173
8.52M
    return InfoIt->second.IDom;
174
8.52M
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::getIDom(llvm::BasicBlock*) const
Line
Count
Source
169
53.8M
  NodePtr getIDom(NodePtr BB) const {
170
53.8M
    auto InfoIt = NodeToInfo.find(BB);
171
53.8M
    if (InfoIt == NodeToInfo.end()) 
return nullptr0
;
172
53.8M
173
53.8M
    return InfoIt->second.IDom;
174
53.8M
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::getIDom(llvm::BasicBlock*) const
Line
Count
Source
169
3.06M
  NodePtr getIDom(NodePtr BB) const {
170
3.06M
    auto InfoIt = NodeToInfo.find(BB);
171
3.06M
    if (InfoIt == NodeToInfo.end()) 
return nullptr0
;
172
3.06M
173
3.06M
    return InfoIt->second.IDom;
174
3.06M
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::getIDom(llvm::VPBlockBase*) const
Line
Count
Source
169
107
  NodePtr getIDom(NodePtr BB) const {
170
107
    auto InfoIt = NodeToInfo.find(BB);
171
107
    if (InfoIt == NodeToInfo.end()) 
return nullptr0
;
172
107
173
107
    return InfoIt->second.IDom;
174
107
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, false> >::getIDom(clang::CFGBlock*) const
Line
Count
Source
169
58
  NodePtr getIDom(NodePtr BB) const {
170
58
    auto InfoIt = NodeToInfo.find(BB);
171
58
    if (InfoIt == NodeToInfo.end()) 
return nullptr0
;
172
58
173
58
    return InfoIt->second.IDom;
174
58
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, true> >::getIDom(clang::CFGBlock*) const
Line
Count
Source
169
549
  NodePtr getIDom(NodePtr BB) const {
170
549
    auto InfoIt = NodeToInfo.find(BB);
171
549
    if (InfoIt == NodeToInfo.end()) 
return nullptr0
;
172
549
173
549
    return InfoIt->second.IDom;
174
549
  }
175
176
74.8M
  TreeNodePtr getNodeForBlock(NodePtr BB, DomTreeT &DT) {
177
74.8M
    if (TreeNodePtr Node = DT.getNode(BB)) 
return Node74.8M
;
178
1
179
1
    // Haven't calculated this node yet?  Get or calculate the node for the
180
1
    // immediate dominator.
181
1
    NodePtr IDom = getIDom(BB);
182
1
183
1
    assert(IDom || DT.DomTreeNodes[nullptr]);
184
1
    TreeNodePtr IDomNode = getNodeForBlock(IDom, DT);
185
1
186
1
    // Add a new tree node for this NodeT, and link it as a child of
187
1
    // IDomNode
188
1
    return (DT.DomTreeNodes[BB] = IDomNode->addChild(
189
1
        llvm::make_unique<DomTreeNodeBase<NodeT>>(BB, IDomNode)))
190
1
        .get();
191
1
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::getNodeForBlock(llvm::MachineBasicBlock*, llvm::DominatorTreeBase<llvm::MachineBasicBlock, false>&)
Line
Count
Source
176
9.38M
  TreeNodePtr getNodeForBlock(NodePtr BB, DomTreeT &DT) {
177
9.38M
    if (TreeNodePtr Node = DT.getNode(BB)) return Node;
178
0
179
0
    // Haven't calculated this node yet?  Get or calculate the node for the
180
0
    // immediate dominator.
181
0
    NodePtr IDom = getIDom(BB);
182
0
183
0
    assert(IDom || DT.DomTreeNodes[nullptr]);
184
0
    TreeNodePtr IDomNode = getNodeForBlock(IDom, DT);
185
0
186
0
    // Add a new tree node for this NodeT, and link it as a child of
187
0
    // IDomNode
188
0
    return (DT.DomTreeNodes[BB] = IDomNode->addChild(
189
0
        llvm::make_unique<DomTreeNodeBase<NodeT>>(BB, IDomNode)))
190
0
        .get();
191
0
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::getNodeForBlock(llvm::MachineBasicBlock*, llvm::DominatorTreeBase<llvm::MachineBasicBlock, true>&)
Line
Count
Source
176
8.52M
  TreeNodePtr getNodeForBlock(NodePtr BB, DomTreeT &DT) {
177
8.52M
    if (TreeNodePtr Node = DT.getNode(BB)) 
return Node8.52M
;
178
6
179
6
    // Haven't calculated this node yet?  Get or calculate the node for the
180
6
    // immediate dominator.
181
6
    NodePtr IDom = getIDom(BB);
182
6
183
6
    assert(IDom || DT.DomTreeNodes[nullptr]);
184
6
    TreeNodePtr IDomNode = getNodeForBlock(IDom, DT);
185
6
186
6
    // Add a new tree node for this NodeT, and link it as a child of
187
6
    // IDomNode
188
6
    return (DT.DomTreeNodes[BB] = IDomNode->addChild(
189
6
        llvm::make_unique<DomTreeNodeBase<NodeT>>(BB, IDomNode)))
190
6
        .get();
191
6
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::getNodeForBlock(llvm::BasicBlock*, llvm::DominatorTreeBase<llvm::BasicBlock, false>&)
Line
Count
Source
176
53.8M
  TreeNodePtr getNodeForBlock(NodePtr BB, DomTreeT &DT) {
177
53.8M
    if (TreeNodePtr Node = DT.getNode(BB)) return Node;
178
0
179
0
    // Haven't calculated this node yet?  Get or calculate the node for the
180
0
    // immediate dominator.
181
0
    NodePtr IDom = getIDom(BB);
182
0
183
0
    assert(IDom || DT.DomTreeNodes[nullptr]);
184
0
    TreeNodePtr IDomNode = getNodeForBlock(IDom, DT);
185
0
186
0
    // Add a new tree node for this NodeT, and link it as a child of
187
0
    // IDomNode
188
0
    return (DT.DomTreeNodes[BB] = IDomNode->addChild(
189
0
        llvm::make_unique<DomTreeNodeBase<NodeT>>(BB, IDomNode)))
190
0
        .get();
191
0
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::getNodeForBlock(llvm::BasicBlock*, llvm::DominatorTreeBase<llvm::BasicBlock, true>&)
Line
Count
Source
176
3.06M
  TreeNodePtr getNodeForBlock(NodePtr BB, DomTreeT &DT) {
177
3.06M
    if (TreeNodePtr 
Node3.06M
= DT.getNode(BB)) return Node;
178
18.4E
179
18.4E
    // Haven't calculated this node yet?  Get or calculate the node for the
180
18.4E
    // immediate dominator.
181
18.4E
    NodePtr IDom = getIDom(BB);
182
18.4E
183
18.4E
    assert(IDom || DT.DomTreeNodes[nullptr]);
184
18.4E
    TreeNodePtr IDomNode = getNodeForBlock(IDom, DT);
185
18.4E
186
18.4E
    // Add a new tree node for this NodeT, and link it as a child of
187
18.4E
    // IDomNode
188
18.4E
    return (DT.DomTreeNodes[BB] = IDomNode->addChild(
189
18.4E
        llvm::make_unique<DomTreeNodeBase<NodeT>>(BB, IDomNode)))
190
18.4E
        .get();
191
18.4E
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::getNodeForBlock(llvm::VPBlockBase*, llvm::DominatorTreeBase<llvm::VPBlockBase, false>&)
Line
Count
Source
176
107
  TreeNodePtr getNodeForBlock(NodePtr BB, DomTreeT &DT) {
177
107
    if (TreeNodePtr Node = DT.getNode(BB)) return Node;
178
0
179
0
    // Haven't calculated this node yet?  Get or calculate the node for the
180
0
    // immediate dominator.
181
0
    NodePtr IDom = getIDom(BB);
182
0
183
0
    assert(IDom || DT.DomTreeNodes[nullptr]);
184
0
    TreeNodePtr IDomNode = getNodeForBlock(IDom, DT);
185
0
186
0
    // Add a new tree node for this NodeT, and link it as a child of
187
0
    // IDomNode
188
0
    return (DT.DomTreeNodes[BB] = IDomNode->addChild(
189
0
        llvm::make_unique<DomTreeNodeBase<NodeT>>(BB, IDomNode)))
190
0
        .get();
191
0
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, false> >::getNodeForBlock(clang::CFGBlock*, llvm::DominatorTreeBase<clang::CFGBlock, false>&)
Line
Count
Source
176
58
  TreeNodePtr getNodeForBlock(NodePtr BB, DomTreeT &DT) {
177
58
    if (TreeNodePtr Node = DT.getNode(BB)) return Node;
178
0
179
0
    // Haven't calculated this node yet?  Get or calculate the node for the
180
0
    // immediate dominator.
181
0
    NodePtr IDom = getIDom(BB);
182
0
183
0
    assert(IDom || DT.DomTreeNodes[nullptr]);
184
0
    TreeNodePtr IDomNode = getNodeForBlock(IDom, DT);
185
0
186
0
    // Add a new tree node for this NodeT, and link it as a child of
187
0
    // IDomNode
188
0
    return (DT.DomTreeNodes[BB] = IDomNode->addChild(
189
0
        llvm::make_unique<DomTreeNodeBase<NodeT>>(BB, IDomNode)))
190
0
        .get();
191
0
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, true> >::getNodeForBlock(clang::CFGBlock*, llvm::DominatorTreeBase<clang::CFGBlock, true>&)
Line
Count
Source
176
549
  TreeNodePtr getNodeForBlock(NodePtr BB, DomTreeT &DT) {
177
549
    if (TreeNodePtr Node = DT.getNode(BB)) return Node;
178
0
179
0
    // Haven't calculated this node yet?  Get or calculate the node for the
180
0
    // immediate dominator.
181
0
    NodePtr IDom = getIDom(BB);
182
0
183
0
    assert(IDom || DT.DomTreeNodes[nullptr]);
184
0
    TreeNodePtr IDomNode = getNodeForBlock(IDom, DT);
185
0
186
0
    // Add a new tree node for this NodeT, and link it as a child of
187
0
    // IDomNode
188
0
    return (DT.DomTreeNodes[BB] = IDomNode->addChild(
189
0
        llvm::make_unique<DomTreeNodeBase<NodeT>>(BB, IDomNode)))
190
0
        .get();
191
0
  }
192
193
91.5M
  static bool AlwaysDescend(NodePtr, NodePtr) { return true; }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::AlwaysDescend(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)
Line
Count
Source
193
10.3M
  static bool AlwaysDescend(NodePtr, NodePtr) { return true; }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::AlwaysDescend(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)
Line
Count
Source
193
16.3M
  static bool AlwaysDescend(NodePtr, NodePtr) { return true; }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::AlwaysDescend(llvm::BasicBlock*, llvm::BasicBlock*)
Line
Count
Source
193
59.5M
  static bool AlwaysDescend(NodePtr, NodePtr) { return true; }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::AlwaysDescend(llvm::BasicBlock*, llvm::BasicBlock*)
Line
Count
Source
193
5.24M
  static bool AlwaysDescend(NodePtr, NodePtr) { return true; }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::AlwaysDescend(llvm::VPBlockBase*, llvm::VPBlockBase*)
Line
Count
Source
193
114
  static bool AlwaysDescend(NodePtr, NodePtr) { return true; }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, false> >::AlwaysDescend(clang::CFGBlock*, clang::CFGBlock*)
Line
Count
Source
193
61
  static bool AlwaysDescend(NodePtr, NodePtr) { return true; }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, true> >::AlwaysDescend(clang::CFGBlock*, clang::CFGBlock*)
Line
Count
Source
193
884
  static bool AlwaysDescend(NodePtr, NodePtr) { return true; }
194
195
  struct BlockNamePrinter {
196
    NodePtr N;
197
198
0
    BlockNamePrinter(NodePtr Block) : N(Block) {}
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::BlockNamePrinter::BlockNamePrinter(llvm::MachineBasicBlock*)
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::BlockNamePrinter::BlockNamePrinter(llvm::MachineBasicBlock*)
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::BlockNamePrinter::BlockNamePrinter(llvm::BasicBlock*)
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::BlockNamePrinter::BlockNamePrinter(llvm::BasicBlock*)
199
0
    BlockNamePrinter(TreeNodePtr TN) : N(TN ? TN->getBlock() : nullptr) {}
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::BlockNamePrinter::BlockNamePrinter(llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*)
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::BlockNamePrinter::BlockNamePrinter(llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*)
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::BlockNamePrinter::BlockNamePrinter(llvm::DomTreeNodeBase<llvm::BasicBlock>*)
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::BlockNamePrinter::BlockNamePrinter(llvm::DomTreeNodeBase<llvm::BasicBlock>*)
200
201
0
    friend raw_ostream &operator<<(raw_ostream &O, const BlockNamePrinter &BP) {
202
0
      if (!BP.N)
203
0
        O << "nullptr";
204
0
      else
205
0
        BP.N->printAsOperand(O, false);
206
0
207
0
      return O;
208
0
    }
Unexecuted instantiation: llvm::DomTreeBuilder::operator<<(llvm::raw_ostream&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::BlockNamePrinter const&)
Unexecuted instantiation: llvm::DomTreeBuilder::operator<<(llvm::raw_ostream&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::BlockNamePrinter const&)
Unexecuted instantiation: llvm::DomTreeBuilder::operator<<(llvm::raw_ostream&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::BlockNamePrinter const&)
Unexecuted instantiation: llvm::DomTreeBuilder::operator<<(llvm::raw_ostream&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::BlockNamePrinter const&)
209
  };
210
211
  // Custom DFS implementation which can skip nodes based on a provided
212
  // predicate. It also collects ReverseChildren so that we don't have to spend
213
  // time getting predecessors in SemiNCA.
214
  //
215
  // If IsReverse is set to true, the DFS walk will be performed backwards
216
  // relative to IsPostDom -- using reverse edges for dominators and forward
217
  // edges for postdominators.
218
  template <bool IsReverse = false, typename DescendCondition>
219
  unsigned runDFS(NodePtr V, unsigned LastNum, DescendCondition Condition,
220
19.0M
                  unsigned AttachToNum) {
221
19.0M
    assert(V);
222
19.0M
    SmallVector<NodePtr, 64> WorkList = {V};
223
19.0M
    if (NodeToInfo.count(V) != 0) 
NodeToInfo[V].Parent = AttachToNum0
;
224
19.0M
225
143M
    while (!WorkList.empty()) {
226
124M
      const NodePtr BB = WorkList.pop_back_val();
227
124M
      auto &BBInfo = NodeToInfo[BB];
228
124M
229
124M
      // Visited nodes always have positive DFS numbers.
230
124M
      if (BBInfo.DFSNum != 0) 
continue11.1M
;
231
113M
      BBInfo.DFSNum = BBInfo.Semi = ++LastNum;
232
113M
      BBInfo.Label = BB;
233
113M
      NumToNode.push_back(BB);
234
113M
235
113M
      constexpr bool Direction = IsReverse != IsPostDom;  // XOR.
236
113M
      for (const NodePtr Succ :
237
143M
           ChildrenGetter<Direction>::Get(BB, BatchUpdates)) {
238
143M
        const auto SIT = NodeToInfo.find(Succ);
239
143M
        // Don't visit nodes more than once but remember to collect
240
143M
        // ReverseChildren.
241
143M
        if (SIT != NodeToInfo.end() && 
SIT->second.DFSNum != 048.4M
) {
242
37.2M
          if (Succ != BB) 
SIT->second.ReverseChildren.push_back(BB)32.6M
;
243
37.2M
          continue;
244
37.2M
        }
245
106M
246
106M
        if (!Condition(BB, Succ)) 
continue778k
;
247
105M
248
105M
        // It's fine to add Succ to the map, because we know that it will be
249
105M
        // visited later.
250
105M
        auto &SuccInfo = NodeToInfo[Succ];
251
105M
        WorkList.push_back(Succ);
252
105M
        SuccInfo.Parent = LastNum;
253
105M
        SuccInfo.ReverseChildren.push_back(BB);
254
105M
      }
255
113M
    }
256
19.0M
257
19.0M
    return LastNum;
258
19.0M
  }
unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::runDFS<false, bool (*)(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)>(llvm::MachineBasicBlock*, unsigned int, bool (*)(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*), unsigned int)
Line
Count
Source
220
2.61M
                  unsigned AttachToNum) {
221
2.61M
    assert(V);
222
2.61M
    SmallVector<NodePtr, 64> WorkList = {V};
223
2.61M
    if (NodeToInfo.count(V) != 0) 
NodeToInfo[V].Parent = AttachToNum0
;
224
2.61M
225
15.6M
    while (!WorkList.empty()) {
226
13.0M
      const NodePtr BB = WorkList.pop_back_val();
227
13.0M
      auto &BBInfo = NodeToInfo[BB];
228
13.0M
229
13.0M
      // Visited nodes always have positive DFS numbers.
230
13.0M
      if (BBInfo.DFSNum != 0) 
continue1.00M
;
231
12.0M
      BBInfo.DFSNum = BBInfo.Semi = ++LastNum;
232
12.0M
      BBInfo.Label = BB;
233
12.0M
      NumToNode.push_back(BB);
234
12.0M
235
12.0M
      constexpr bool Direction = IsReverse != IsPostDom;  // XOR.
236
12.0M
      for (const NodePtr Succ :
237
14.2M
           ChildrenGetter<Direction>::Get(BB, BatchUpdates)) {
238
14.2M
        const auto SIT = NodeToInfo.find(Succ);
239
14.2M
        // Don't visit nodes more than once but remember to collect
240
14.2M
        // ReverseChildren.
241
14.2M
        if (SIT != NodeToInfo.end() && 
SIT->second.DFSNum != 04.88M
) {
242
3.88M
          if (Succ != BB) 
SIT->second.ReverseChildren.push_back(BB)3.38M
;
243
3.88M
          continue;
244
3.88M
        }
245
10.3M
246
10.3M
        if (!Condition(BB, Succ)) 
continue0
;
247
10.3M
248
10.3M
        // It's fine to add Succ to the map, because we know that it will be
249
10.3M
        // visited later.
250
10.3M
        auto &SuccInfo = NodeToInfo[Succ];
251
10.3M
        WorkList.push_back(Succ);
252
10.3M
        SuccInfo.Parent = LastNum;
253
10.3M
        SuccInfo.ReverseChildren.push_back(BB);
254
10.3M
      }
255
12.0M
    }
256
2.61M
257
2.61M
    return LastNum;
258
2.61M
  }
Unexecuted instantiation: unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::runDFS<true, bool (*)(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)>(llvm::MachineBasicBlock*, unsigned int, bool (*)(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*), unsigned int)
Unexecuted instantiation: unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::runDFS<false, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::ComputeUnreachableDominators(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::BatchUpdateInfo*, llvm::MachineBasicBlock*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*, llvm::SmallVectorImpl<std::__1::pair<llvm::MachineBasicBlock*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*> >&)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)>(llvm::MachineBasicBlock*, unsigned int, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::ComputeUnreachableDominators(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::BatchUpdateInfo*, llvm::MachineBasicBlock*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*, llvm::SmallVectorImpl<std::__1::pair<llvm::MachineBasicBlock*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*> >&)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*), unsigned int)
Unexecuted instantiation: unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::runDFS<false, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::DeleteReachable(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)>(llvm::MachineBasicBlock*, unsigned int, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::DeleteReachable(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*), unsigned int)
Unexecuted instantiation: unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::runDFS<false, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::DeleteUnreachable(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)>(llvm::MachineBasicBlock*, unsigned int, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::DeleteUnreachable(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*), unsigned int)
Unexecuted instantiation: unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::runDFS<false, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::DeleteUnreachable(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*)::'lambda0'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)>(llvm::MachineBasicBlock*, unsigned int, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::DeleteUnreachable(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*)::'lambda0'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*), unsigned int)
Unexecuted instantiation: unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::runDFS<false, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::verifyParentProperty(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> const&)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)>(llvm::MachineBasicBlock*, unsigned int, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::verifyParentProperty(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> const&)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*), unsigned int)
Unexecuted instantiation: unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::runDFS<false, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::verifySiblingProperty(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> const&)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)>(llvm::MachineBasicBlock*, unsigned int, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::verifySiblingProperty(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> const&)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*), unsigned int)
unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::runDFS<false, bool (*)(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)>(llvm::MachineBasicBlock*, unsigned int, bool (*)(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*), unsigned int)
Line
Count
Source
220
3.85M
                  unsigned AttachToNum) {
221
3.85M
    assert(V);
222
3.85M
    SmallVector<NodePtr, 64> WorkList = {V};
223
3.85M
    if (NodeToInfo.count(V) != 0) 
NodeToInfo[V].Parent = AttachToNum0
;
224
3.85M
225
24.1M
    while (!WorkList.empty()) {
226
20.2M
      const NodePtr BB = WorkList.pop_back_val();
227
20.2M
      auto &BBInfo = NodeToInfo[BB];
228
20.2M
229
20.2M
      // Visited nodes always have positive DFS numbers.
230
20.2M
      if (BBInfo.DFSNum != 0) 
continue3.19M
;
231
17.0M
      BBInfo.DFSNum = BBInfo.Semi = ++LastNum;
232
17.0M
      BBInfo.Label = BB;
233
17.0M
      NumToNode.push_back(BB);
234
17.0M
235
17.0M
      constexpr bool Direction = IsReverse != IsPostDom;  // XOR.
236
17.0M
      for (const NodePtr Succ :
237
21.2M
           ChildrenGetter<Direction>::Get(BB, BatchUpdates)) {
238
21.2M
        const auto SIT = NodeToInfo.find(Succ);
239
21.2M
        // Don't visit nodes more than once but remember to collect
240
21.2M
        // ReverseChildren.
241
21.2M
        if (SIT != NodeToInfo.end() && 
SIT->second.DFSNum != 08.08M
) {
242
4.88M
          if (Succ != BB) 
SIT->second.ReverseChildren.push_back(BB)4.15M
;
243
4.88M
          continue;
244
4.88M
        }
245
16.3M
246
16.3M
        if (!Condition(BB, Succ)) 
continue0
;
247
16.3M
248
16.3M
        // It's fine to add Succ to the map, because we know that it will be
249
16.3M
        // visited later.
250
16.3M
        auto &SuccInfo = NodeToInfo[Succ];
251
16.3M
        WorkList.push_back(Succ);
252
16.3M
        SuccInfo.Parent = LastNum;
253
16.3M
        SuccInfo.ReverseChildren.push_back(BB);
254
16.3M
      }
255
17.0M
    }
256
3.85M
257
3.85M
    return LastNum;
258
3.85M
  }
unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::runDFS<true, bool (*)(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)>(llvm::MachineBasicBlock*, unsigned int, bool (*)(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*), unsigned int)
Line
Count
Source
220
2.77k
                  unsigned AttachToNum) {
221
2.77k
    assert(V);
222
2.77k
    SmallVector<NodePtr, 64> WorkList = {V};
223
2.77k
    if (NodeToInfo.count(V) != 0) 
NodeToInfo[V].Parent = AttachToNum0
;
224
2.77k
225
11.6k
    while (!WorkList.empty()) {
226
8.91k
      const NodePtr BB = WorkList.pop_back_val();
227
8.91k
      auto &BBInfo = NodeToInfo[BB];
228
8.91k
229
8.91k
      // Visited nodes always have positive DFS numbers.
230
8.91k
      if (BBInfo.DFSNum != 0) 
continue1.50k
;
231
7.41k
      BBInfo.DFSNum = BBInfo.Semi = ++LastNum;
232
7.41k
      BBInfo.Label = BB;
233
7.41k
      NumToNode.push_back(BB);
234
7.41k
235
7.41k
      constexpr bool Direction = IsReverse != IsPostDom;  // XOR.
236
7.41k
      for (const NodePtr Succ :
237
12.2k
           ChildrenGetter<Direction>::Get(BB, BatchUpdates)) {
238
12.2k
        const auto SIT = NodeToInfo.find(Succ);
239
12.2k
        // Don't visit nodes more than once but remember to collect
240
12.2k
        // ReverseChildren.
241
12.2k
        if (SIT != NodeToInfo.end() && 
SIT->second.DFSNum != 07.60k
) {
242
6.10k
          if (Succ != BB) 
SIT->second.ReverseChildren.push_back(BB)3.45k
;
243
6.10k
          continue;
244
6.10k
        }
245
6.13k
246
6.13k
        if (!Condition(BB, Succ)) 
continue0
;
247
6.13k
248
6.13k
        // It's fine to add Succ to the map, because we know that it will be
249
6.13k
        // visited later.
250
6.13k
        auto &SuccInfo = NodeToInfo[Succ];
251
6.13k
        WorkList.push_back(Succ);
252
6.13k
        SuccInfo.Parent = LastNum;
253
6.13k
        SuccInfo.ReverseChildren.push_back(BB);
254
6.13k
      }
255
7.41k
    }
256
2.77k
257
2.77k
    return LastNum;
258
2.77k
  }
Unexecuted instantiation: unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::runDFS<false, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::ComputeUnreachableDominators(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::BatchUpdateInfo*, llvm::MachineBasicBlock*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*, llvm::SmallVectorImpl<std::__1::pair<llvm::MachineBasicBlock*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*> >&)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)>(llvm::MachineBasicBlock*, unsigned int, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::ComputeUnreachableDominators(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::BatchUpdateInfo*, llvm::MachineBasicBlock*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*, llvm::SmallVectorImpl<std::__1::pair<llvm::MachineBasicBlock*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*> >&)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*), unsigned int)
Unexecuted instantiation: unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::runDFS<false, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::DeleteReachable(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)>(llvm::MachineBasicBlock*, unsigned int, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::DeleteReachable(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*), unsigned int)
Unexecuted instantiation: unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::runDFS<false, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::verifyParentProperty(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> const&)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)>(llvm::MachineBasicBlock*, unsigned int, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::verifyParentProperty(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> const&)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*), unsigned int)
Unexecuted instantiation: unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::runDFS<false, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::verifySiblingProperty(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> const&)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)>(llvm::MachineBasicBlock*, unsigned int, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::verifySiblingProperty(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> const&)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*), unsigned int)
Unexecuted instantiation: unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::runDFS<false, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::DeleteUnreachable(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)>(llvm::MachineBasicBlock*, unsigned int, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::DeleteUnreachable(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*), unsigned int)
Unexecuted instantiation: unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::runDFS<false, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::DeleteUnreachable(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*)::'lambda0'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)>(llvm::MachineBasicBlock*, unsigned int, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::DeleteUnreachable(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*)::'lambda0'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*), unsigned int)
unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::runDFS<false, bool (*)(llvm::BasicBlock*, llvm::BasicBlock*)>(llvm::BasicBlock*, unsigned int, bool (*)(llvm::BasicBlock*, llvm::BasicBlock*), unsigned int)
Line
Count
Source
220
10.3M
                  unsigned AttachToNum) {
221
10.3M
    assert(V);
222
10.3M
    SmallVector<NodePtr, 64> WorkList = {V};
223
10.3M
    if (NodeToInfo.count(V) != 0) 
NodeToInfo[V].Parent = AttachToNum0
;
224
10.3M
225
80.2M
    while (!WorkList.empty()) {
226
69.8M
      const NodePtr BB = WorkList.pop_back_val();
227
69.8M
      auto &BBInfo = NodeToInfo[BB];
228
69.8M
229
69.8M
      // Visited nodes always have positive DFS numbers.
230
69.8M
      if (BBInfo.DFSNum != 0) 
continue5.85M
;
231
64.0M
      BBInfo.DFSNum = BBInfo.Semi = ++LastNum;
232
64.0M
      BBInfo.Label = BB;
233
64.0M
      NumToNode.push_back(BB);
234
64.0M
235
64.0M
      constexpr bool Direction = IsReverse != IsPostDom;  // XOR.
236
64.0M
      for (const NodePtr Succ :
237
83.5M
           ChildrenGetter<Direction>::Get(BB, BatchUpdates)) {
238
83.5M
        const auto SIT = NodeToInfo.find(Succ);
239
83.5M
        // Don't visit nodes more than once but remember to collect
240
83.5M
        // ReverseChildren.
241
83.5M
        if (SIT != NodeToInfo.end() && 
SIT->second.DFSNum != 029.9M
) {
242
24.0M
          if (Succ != BB) 
SIT->second.ReverseChildren.push_back(BB)21.2M
;
243
24.0M
          continue;
244
24.0M
        }
245
59.5M
246
59.5M
        if (!Condition(BB, Succ)) 
continue0
;
247
59.5M
248
59.5M
        // It's fine to add Succ to the map, because we know that it will be
249
59.5M
        // visited later.
250
59.5M
        auto &SuccInfo = NodeToInfo[Succ];
251
59.5M
        WorkList.push_back(Succ);
252
59.5M
        SuccInfo.Parent = LastNum;
253
59.5M
        SuccInfo.ReverseChildren.push_back(BB);
254
59.5M
      }
255
64.0M
    }
256
10.3M
257
10.3M
    return LastNum;
258
10.3M
  }
unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::runDFS<false, bool (*)(llvm::BasicBlock*, llvm::BasicBlock*)>(llvm::BasicBlock*, unsigned int, bool (*)(llvm::BasicBlock*, llvm::BasicBlock*), unsigned int)
Line
Count
Source
220
1.32M
                  unsigned AttachToNum) {
221
1.32M
    assert(V);
222
1.32M
    SmallVector<NodePtr, 64> WorkList = {V};
223
1.32M
    if (NodeToInfo.count(V) != 0) 
NodeToInfo[V].Parent = AttachToNum0
;
224
1.32M
225
7.89M
    while (!WorkList.empty()) {
226
6.57M
      const NodePtr BB = WorkList.pop_back_val();
227
6.57M
      auto &BBInfo = NodeToInfo[BB];
228
6.57M
229
6.57M
      // Visited nodes always have positive DFS numbers.
230
6.57M
      if (BBInfo.DFSNum != 0) 
continue440k
;
231
6.13M
      BBInfo.DFSNum = BBInfo.Semi = ++LastNum;
232
6.13M
      BBInfo.Label = BB;
233
6.13M
      NumToNode.push_back(BB);
234
6.13M
235
6.13M
      constexpr bool Direction = IsReverse != IsPostDom;  // XOR.
236
6.13M
      for (const NodePtr Succ :
237
7.56M
           ChildrenGetter<Direction>::Get(BB, BatchUpdates)) {
238
7.56M
        const auto SIT = NodeToInfo.find(Succ);
239
7.56M
        // Don't visit nodes more than once but remember to collect
240
7.56M
        // ReverseChildren.
241
7.56M
        if (SIT != NodeToInfo.end() && 
SIT->second.DFSNum != 02.75M
) {
242
2.31M
          if (Succ != BB) 
SIT->second.ReverseChildren.push_back(BB)2.10M
;
243
2.31M
          continue;
244
2.31M
        }
245
5.24M
246
5.24M
        if (!Condition(BB, Succ)) 
continue0
;
247
5.24M
248
5.24M
        // It's fine to add Succ to the map, because we know that it will be
249
5.24M
        // visited later.
250
5.24M
        auto &SuccInfo = NodeToInfo[Succ];
251
5.24M
        WorkList.push_back(Succ);
252
5.24M
        SuccInfo.Parent = LastNum;
253
5.24M
        SuccInfo.ReverseChildren.push_back(BB);
254
5.24M
      }
255
6.13M
    }
256
1.32M
257
1.32M
    return LastNum;
258
1.32M
  }
unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::runDFS<true, bool (*)(llvm::BasicBlock*, llvm::BasicBlock*)>(llvm::BasicBlock*, unsigned int, bool (*)(llvm::BasicBlock*, llvm::BasicBlock*), unsigned int)
Line
Count
Source
220
1.21k
                  unsigned AttachToNum) {
221
1.21k
    assert(V);
222
1.21k
    SmallVector<NodePtr, 64> WorkList = {V};
223
1.21k
    if (NodeToInfo.count(V) != 0) 
NodeToInfo[V].Parent = AttachToNum0
;
224
1.21k
225
4.15k
    while (!WorkList.empty()) {
226
2.94k
      const NodePtr BB = WorkList.pop_back_val();
227
2.94k
      auto &BBInfo = NodeToInfo[BB];
228
2.94k
229
2.94k
      // Visited nodes always have positive DFS numbers.
230
2.94k
      if (BBInfo.DFSNum != 0) 
continue105
;
231
2.83k
      BBInfo.DFSNum = BBInfo.Semi = ++LastNum;
232
2.83k
      BBInfo.Label = BB;
233
2.83k
      NumToNode.push_back(BB);
234
2.83k
235
2.83k
      constexpr bool Direction = IsReverse != IsPostDom;  // XOR.
236
2.83k
      for (const NodePtr Succ :
237
3.20k
           ChildrenGetter<Direction>::Get(BB, BatchUpdates)) {
238
3.20k
        const auto SIT = NodeToInfo.find(Succ);
239
3.20k
        // Don't visit nodes more than once but remember to collect
240
3.20k
        // ReverseChildren.
241
3.20k
        if (SIT != NodeToInfo.end() && 
SIT->second.DFSNum != 01.58k
) {
242
1.47k
          if (Succ != BB) 
SIT->second.ReverseChildren.push_back(BB)814
;
243
1.47k
          continue;
244
1.47k
        }
245
1.72k
246
1.72k
        if (!Condition(BB, Succ)) 
continue0
;
247
1.72k
248
1.72k
        // It's fine to add Succ to the map, because we know that it will be
249
1.72k
        // visited later.
250
1.72k
        auto &SuccInfo = NodeToInfo[Succ];
251
1.72k
        WorkList.push_back(Succ);
252
1.72k
        SuccInfo.Parent = LastNum;
253
1.72k
        SuccInfo.ReverseChildren.push_back(BB);
254
1.72k
      }
255
2.83k
    }
256
1.21k
257
1.21k
    return LastNum;
258
1.21k
  }
unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::runDFS<false, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::ComputeUnreachableDominators(llvm::DominatorTreeBase<llvm::BasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::BatchUpdateInfo*, llvm::BasicBlock*, llvm::DomTreeNodeBase<llvm::BasicBlock>*, llvm::SmallVectorImpl<std::__1::pair<llvm::BasicBlock*, llvm::DomTreeNodeBase<llvm::BasicBlock>*> >&)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*)>(llvm::BasicBlock*, unsigned int, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::ComputeUnreachableDominators(llvm::DominatorTreeBase<llvm::BasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::BatchUpdateInfo*, llvm::BasicBlock*, llvm::DomTreeNodeBase<llvm::BasicBlock>*, llvm::SmallVectorImpl<std::__1::pair<llvm::BasicBlock*, llvm::DomTreeNodeBase<llvm::BasicBlock>*> >&)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*), unsigned int)
Line
Count
Source
220
114k
                  unsigned AttachToNum) {
221
114k
    assert(V);
222
114k
    SmallVector<NodePtr, 64> WorkList = {V};
223
114k
    if (NodeToInfo.count(V) != 0) 
NodeToInfo[V].Parent = AttachToNum0
;
224
114k
225
354k
    while (!WorkList.empty()) {
226
239k
      const NodePtr BB = WorkList.pop_back_val();
227
239k
      auto &BBInfo = NodeToInfo[BB];
228
239k
229
239k
      // Visited nodes always have positive DFS numbers.
230
239k
      if (BBInfo.DFSNum != 0) 
continue11.5k
;
231
228k
      BBInfo.DFSNum = BBInfo.Semi = ++LastNum;
232
228k
      BBInfo.Label = BB;
233
228k
      NumToNode.push_back(BB);
234
228k
235
228k
      constexpr bool Direction = IsReverse != IsPostDom;  // XOR.
236
228k
      for (const NodePtr Succ :
237
228k
           ChildrenGetter<Direction>::Get(BB, BatchUpdates)) {
238
189k
        const auto SIT = NodeToInfo.find(Succ);
239
189k
        // Don't visit nodes more than once but remember to collect
240
189k
        // ReverseChildren.
241
189k
        if (SIT != NodeToInfo.end() && 
SIT->second.DFSNum != 049.8k
) {
242
38.2k
          if (Succ != BB) 
SIT->second.ReverseChildren.push_back(BB)33.5k
;
243
38.2k
          continue;
244
38.2k
        }
245
150k
246
150k
        if (!Condition(BB, Succ)) 
continue25.4k
;
247
125k
248
125k
        // It's fine to add Succ to the map, because we know that it will be
249
125k
        // visited later.
250
125k
        auto &SuccInfo = NodeToInfo[Succ];
251
125k
        WorkList.push_back(Succ);
252
125k
        SuccInfo.Parent = LastNum;
253
125k
        SuccInfo.ReverseChildren.push_back(BB);
254
125k
      }
255
228k
    }
256
114k
257
114k
    return LastNum;
258
114k
  }
unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::runDFS<false, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::ComputeUnreachableDominators(llvm::DominatorTreeBase<llvm::BasicBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::BatchUpdateInfo*, llvm::BasicBlock*, llvm::DomTreeNodeBase<llvm::BasicBlock>*, llvm::SmallVectorImpl<std::__1::pair<llvm::BasicBlock*, llvm::DomTreeNodeBase<llvm::BasicBlock>*> >&)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*)>(llvm::BasicBlock*, unsigned int, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::ComputeUnreachableDominators(llvm::DominatorTreeBase<llvm::BasicBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::BatchUpdateInfo*, llvm::BasicBlock*, llvm::DomTreeNodeBase<llvm::BasicBlock>*, llvm::SmallVectorImpl<std::__1::pair<llvm::BasicBlock*, llvm::DomTreeNodeBase<llvm::BasicBlock>*> >&)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*), unsigned int)
Line
Count
Source
220
3
                  unsigned AttachToNum) {
221
3
    assert(V);
222
3
    SmallVector<NodePtr, 64> WorkList = {V};
223
3
    if (NodeToInfo.count(V) != 0) 
NodeToInfo[V].Parent = AttachToNum0
;
224
3
225
6
    while (!WorkList.empty()) {
226
3
      const NodePtr BB = WorkList.pop_back_val();
227
3
      auto &BBInfo = NodeToInfo[BB];
228
3
229
3
      // Visited nodes always have positive DFS numbers.
230
3
      if (BBInfo.DFSNum != 0) 
continue0
;
231
3
      BBInfo.DFSNum = BBInfo.Semi = ++LastNum;
232
3
      BBInfo.Label = BB;
233
3
      NumToNode.push_back(BB);
234
3
235
3
      constexpr bool Direction = IsReverse != IsPostDom;  // XOR.
236
3
      for (const NodePtr Succ :
237
3
           ChildrenGetter<Direction>::Get(BB, BatchUpdates)) {
238
0
        const auto SIT = NodeToInfo.find(Succ);
239
0
        // Don't visit nodes more than once but remember to collect
240
0
        // ReverseChildren.
241
0
        if (SIT != NodeToInfo.end() && SIT->second.DFSNum != 0) {
242
0
          if (Succ != BB) SIT->second.ReverseChildren.push_back(BB);
243
0
          continue;
244
0
        }
245
0
246
0
        if (!Condition(BB, Succ)) continue;
247
0
248
0
        // It's fine to add Succ to the map, because we know that it will be
249
0
        // visited later.
250
0
        auto &SuccInfo = NodeToInfo[Succ];
251
0
        WorkList.push_back(Succ);
252
0
        SuccInfo.Parent = LastNum;
253
0
        SuccInfo.ReverseChildren.push_back(BB);
254
0
      }
255
3
    }
256
3
257
3
    return LastNum;
258
3
  }
unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::runDFS<false, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::DeleteReachable(llvm::DominatorTreeBase<llvm::BasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::BasicBlock>*, llvm::DomTreeNodeBase<llvm::BasicBlock>*)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*)>(llvm::BasicBlock*, unsigned int, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::DeleteReachable(llvm::DominatorTreeBase<llvm::BasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::BasicBlock>*, llvm::DomTreeNodeBase<llvm::BasicBlock>*)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*), unsigned int)
Line
Count
Source
220
399k
                  unsigned AttachToNum) {
221
399k
    assert(V);
222
399k
    SmallVector<NodePtr, 64> WorkList = {V};
223
399k
    if (NodeToInfo.count(V) != 0) 
NodeToInfo[V].Parent = AttachToNum0
;
224
399k
225
14.3M
    while (!WorkList.empty()) {
226
13.9M
      const NodePtr BB = WorkList.pop_back_val();
227
13.9M
      auto &BBInfo = NodeToInfo[BB];
228
13.9M
229
13.9M
      // Visited nodes always have positive DFS numbers.
230
13.9M
      if (BBInfo.DFSNum != 0) 
continue651k
;
231
13.2M
      BBInfo.DFSNum = BBInfo.Semi = ++LastNum;
232
13.2M
      BBInfo.Label = BB;
233
13.2M
      NumToNode.push_back(BB);
234
13.2M
235
13.2M
      constexpr bool Direction = IsReverse != IsPostDom;  // XOR.
236
13.2M
      for (const NodePtr Succ :
237
16.1M
           ChildrenGetter<Direction>::Get(BB, BatchUpdates)) {
238
16.1M
        const auto SIT = NodeToInfo.find(Succ);
239
16.1M
        // Don't visit nodes more than once but remember to collect
240
16.1M
        // ReverseChildren.
241
16.1M
        if (SIT != NodeToInfo.end() && 
SIT->second.DFSNum != 02.60M
) {
242
1.95M
          if (Succ != BB) 
SIT->second.ReverseChildren.push_back(BB)1.66M
;
243
1.95M
          continue;
244
1.95M
        }
245
14.1M
246
14.1M
        if (!Condition(BB, Succ)) 
continue660k
;
247
13.5M
248
13.5M
        // It's fine to add Succ to the map, because we know that it will be
249
13.5M
        // visited later.
250
13.5M
        auto &SuccInfo = NodeToInfo[Succ];
251
13.5M
        WorkList.push_back(Succ);
252
13.5M
        SuccInfo.Parent = LastNum;
253
13.5M
        SuccInfo.ReverseChildren.push_back(BB);
254
13.5M
      }
255
13.2M
    }
256
399k
257
399k
    return LastNum;
258
399k
  }
unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::runDFS<false, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::DeleteUnreachable(llvm::DominatorTreeBase<llvm::BasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::BasicBlock>*)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*)>(llvm::BasicBlock*, unsigned int, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::DeleteUnreachable(llvm::DominatorTreeBase<llvm::BasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::BasicBlock>*)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*), unsigned int)
Line
Count
Source
220
303k
                  unsigned AttachToNum) {
221
303k
    assert(V);
222
303k
    SmallVector<NodePtr, 64> WorkList = {V};
223
303k
    if (NodeToInfo.count(V) != 0) 
NodeToInfo[V].Parent = AttachToNum0
;
224
303k
225
737k
    while (!WorkList.empty()) {
226
433k
      const NodePtr BB = WorkList.pop_back_val();
227
433k
      auto &BBInfo = NodeToInfo[BB];
228
433k
229
433k
      // Visited nodes always have positive DFS numbers.
230
433k
      if (BBInfo.DFSNum != 0) 
continue10.1k
;
231
423k
      BBInfo.DFSNum = BBInfo.Semi = ++LastNum;
232
423k
      BBInfo.Label = BB;
233
423k
      NumToNode.push_back(BB);
234
423k
235
423k
      constexpr bool Direction = IsReverse != IsPostDom;  // XOR.
236
423k
      for (const NodePtr Succ :
237
423k
           ChildrenGetter<Direction>::Get(BB, BatchUpdates)) {
238
225k
        const auto SIT = NodeToInfo.find(Succ);
239
225k
        // Don't visit nodes more than once but remember to collect
240
225k
        // ReverseChildren.
241
225k
        if (SIT != NodeToInfo.end() && 
SIT->second.DFSNum != 060.7k
) {
242
50.5k
          if (Succ != BB) 
SIT->second.ReverseChildren.push_back(BB)32.7k
;
243
50.5k
          continue;
244
50.5k
        }
245
174k
246
174k
        if (!Condition(BB, Succ)) 
continue44.3k
;
247
130k
248
130k
        // It's fine to add Succ to the map, because we know that it will be
249
130k
        // visited later.
250
130k
        auto &SuccInfo = NodeToInfo[Succ];
251
130k
        WorkList.push_back(Succ);
252
130k
        SuccInfo.Parent = LastNum;
253
130k
        SuccInfo.ReverseChildren.push_back(BB);
254
130k
      }
255
423k
    }
256
303k
257
303k
    return LastNum;
258
303k
  }
unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::runDFS<false, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::DeleteUnreachable(llvm::DominatorTreeBase<llvm::BasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::BasicBlock>*)::'lambda0'(llvm::BasicBlock*, llvm::BasicBlock*)>(llvm::BasicBlock*, unsigned int, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::DeleteUnreachable(llvm::DominatorTreeBase<llvm::BasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::BasicBlock>*)::'lambda0'(llvm::BasicBlock*, llvm::BasicBlock*), unsigned int)
Line
Count
Source
220
24.0k
                  unsigned AttachToNum) {
221
24.0k
    assert(V);
222
24.0k
    SmallVector<NodePtr, 64> WorkList = {V};
223
24.0k
    if (NodeToInfo.count(V) != 0) 
NodeToInfo[V].Parent = AttachToNum0
;
224
24.0k
225
358k
    while (!WorkList.empty()) {
226
334k
      const NodePtr BB = WorkList.pop_back_val();
227
334k
      auto &BBInfo = NodeToInfo[BB];
228
334k
229
334k
      // Visited nodes always have positive DFS numbers.
230
334k
      if (BBInfo.DFSNum != 0) 
continue17.9k
;
231
316k
      BBInfo.DFSNum = BBInfo.Semi = ++LastNum;
232
316k
      BBInfo.Label = BB;
233
316k
      NumToNode.push_back(BB);
234
316k
235
316k
      constexpr bool Direction = IsReverse != IsPostDom;  // XOR.
236
316k
      for (const NodePtr Succ :
237
439k
           ChildrenGetter<Direction>::Get(BB, BatchUpdates)) {
238
439k
        const auto SIT = NodeToInfo.find(Succ);
239
439k
        // Don't visit nodes more than once but remember to collect
240
439k
        // ReverseChildren.
241
439k
        if (SIT != NodeToInfo.end() && 
SIT->second.DFSNum != 0107k
) {
242
89.5k
          if (Succ != BB) 
SIT->second.ReverseChildren.push_back(BB)75.9k
;
243
89.5k
          continue;
244
89.5k
        }
245
349k
246
349k
        if (!Condition(BB, Succ)) 
continue39.2k
;
247
310k
248
310k
        // It's fine to add Succ to the map, because we know that it will be
249
310k
        // visited later.
250
310k
        auto &SuccInfo = NodeToInfo[Succ];
251
310k
        WorkList.push_back(Succ);
252
310k
        SuccInfo.Parent = LastNum;
253
310k
        SuccInfo.ReverseChildren.push_back(BB);
254
310k
      }
255
316k
    }
256
24.0k
257
24.0k
    return LastNum;
258
24.0k
  }
unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::runDFS<false, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::DeleteReachable(llvm::DominatorTreeBase<llvm::BasicBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::BasicBlock>*, llvm::DomTreeNodeBase<llvm::BasicBlock>*)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*)>(llvm::BasicBlock*, unsigned int, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::DeleteReachable(llvm::DominatorTreeBase<llvm::BasicBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::BasicBlock>*, llvm::DomTreeNodeBase<llvm::BasicBlock>*)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*), unsigned int)
Line
Count
Source
220
93
                  unsigned AttachToNum) {
221
93
    assert(V);
222
93
    SmallVector<NodePtr, 64> WorkList = {V};
223
93
    if (NodeToInfo.count(V) != 0) 
NodeToInfo[V].Parent = AttachToNum0
;
224
93
225
478
    while (!WorkList.empty()) {
226
385
      const NodePtr BB = WorkList.pop_back_val();
227
385
      auto &BBInfo = NodeToInfo[BB];
228
385
229
385
      // Visited nodes always have positive DFS numbers.
230
385
      if (BBInfo.DFSNum != 0) 
continue13
;
231
372
      BBInfo.DFSNum = BBInfo.Semi = ++LastNum;
232
372
      BBInfo.Label = BB;
233
372
      NumToNode.push_back(BB);
234
372
235
372
      constexpr bool Direction = IsReverse != IsPostDom;  // XOR.
236
372
      for (const NodePtr Succ :
237
392
           ChildrenGetter<Direction>::Get(BB, BatchUpdates)) {
238
392
        const auto SIT = NodeToInfo.find(Succ);
239
392
        // Don't visit nodes more than once but remember to collect
240
392
        // ReverseChildren.
241
392
        if (SIT != NodeToInfo.end() && 
SIT->second.DFSNum != 044
) {
242
31
          if (Succ != BB) 
SIT->second.ReverseChildren.push_back(BB)28
;
243
31
          continue;
244
31
        }
245
361
246
361
        if (!Condition(BB, Succ)) 
continue69
;
247
292
248
292
        // It's fine to add Succ to the map, because we know that it will be
249
292
        // visited later.
250
292
        auto &SuccInfo = NodeToInfo[Succ];
251
292
        WorkList.push_back(Succ);
252
292
        SuccInfo.Parent = LastNum;
253
292
        SuccInfo.ReverseChildren.push_back(BB);
254
292
      }
255
372
    }
256
93
257
93
    return LastNum;
258
93
  }
unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::runDFS<false, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::verifyParentProperty(llvm::DominatorTreeBase<llvm::BasicBlock, false> const&)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*)>(llvm::BasicBlock*, unsigned int, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::verifyParentProperty(llvm::DominatorTreeBase<llvm::BasicBlock, false> const&)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*), unsigned int)
Line
Count
Source
220
1.73k
                  unsigned AttachToNum) {
221
1.73k
    assert(V);
222
1.73k
    SmallVector<NodePtr, 64> WorkList = {V};
223
1.73k
    if (NodeToInfo.count(V) != 0) 
NodeToInfo[V].Parent = AttachToNum0
;
224
1.73k
225
9.69k
    while (!WorkList.empty()) {
226
7.95k
      const NodePtr BB = WorkList.pop_back_val();
227
7.95k
      auto &BBInfo = NodeToInfo[BB];
228
7.95k
229
7.95k
      // Visited nodes always have positive DFS numbers.
230
7.95k
      if (BBInfo.DFSNum != 0) 
continue141
;
231
7.81k
      BBInfo.DFSNum = BBInfo.Semi = ++LastNum;
232
7.81k
      BBInfo.Label = BB;
233
7.81k
      NumToNode.push_back(BB);
234
7.81k
235
7.81k
      constexpr bool Direction = IsReverse != IsPostDom;  // XOR.
236
7.81k
      for (const NodePtr Succ :
237
8.68k
           ChildrenGetter<Direction>::Get(BB, BatchUpdates)) {
238
8.68k
        const auto SIT = NodeToInfo.find(Succ);
239
8.68k
        // Don't visit nodes more than once but remember to collect
240
8.68k
        // ReverseChildren.
241
8.68k
        if (SIT != NodeToInfo.end() && 
SIT->second.DFSNum != 0768
) {
242
627
          if (Succ != BB) 
SIT->second.ReverseChildren.push_back(BB)450
;
243
627
          continue;
244
627
        }
245
8.06k
246
8.06k
        if (!Condition(BB, Succ)) 
continue1.84k
;
247
6.21k
248
6.21k
        // It's fine to add Succ to the map, because we know that it will be
249
6.21k
        // visited later.
250
6.21k
        auto &SuccInfo = NodeToInfo[Succ];
251
6.21k
        WorkList.push_back(Succ);
252
6.21k
        SuccInfo.Parent = LastNum;
253
6.21k
        SuccInfo.ReverseChildren.push_back(BB);
254
6.21k
      }
255
7.81k
    }
256
1.73k
257
1.73k
    return LastNum;
258
1.73k
  }
unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::runDFS<false, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::verifySiblingProperty(llvm::DominatorTreeBase<llvm::BasicBlock, false> const&)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*)>(llvm::BasicBlock*, unsigned int, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::verifySiblingProperty(llvm::DominatorTreeBase<llvm::BasicBlock, false> const&)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*), unsigned int)
Line
Count
Source
220
2.46k
                  unsigned AttachToNum) {
221
2.46k
    assert(V);
222
2.46k
    SmallVector<NodePtr, 64> WorkList = {V};
223
2.46k
    if (NodeToInfo.count(V) != 0) 
NodeToInfo[V].Parent = AttachToNum0
;
224
2.46k
225
19.2k
    while (!WorkList.empty()) {
226
16.7k
      const NodePtr BB = WorkList.pop_back_val();
227
16.7k
      auto &BBInfo = NodeToInfo[BB];
228
16.7k
229
16.7k
      // Visited nodes always have positive DFS numbers.
230
16.7k
      if (BBInfo.DFSNum != 0) 
continue351
;
231
16.4k
      BBInfo.DFSNum = BBInfo.Semi = ++LastNum;
232
16.4k
      BBInfo.Label = BB;
233
16.4k
      NumToNode.push_back(BB);
234
16.4k
235
16.4k
      constexpr bool Direction = IsReverse != IsPostDom;  // XOR.
236
16.4k
      for (const NodePtr Succ :
237
18.5k
           ChildrenGetter<Direction>::Get(BB, BatchUpdates)) {
238
18.5k
        const auto SIT = NodeToInfo.find(Succ);
239
18.5k
        // Don't visit nodes more than once but remember to collect
240
18.5k
        // ReverseChildren.
241
18.5k
        if (SIT != NodeToInfo.end() && 
SIT->second.DFSNum != 01.88k
) {
242
1.53k
          if (Succ != BB) 
SIT->second.ReverseChildren.push_back(BB)1.28k
;
243
1.53k
          continue;
244
1.53k
        }
245
17.0k
246
17.0k
        if (!Condition(BB, Succ)) 
continue2.74k
;
247
14.3k
248
14.3k
        // It's fine to add Succ to the map, because we know that it will be
249
14.3k
        // visited later.
250
14.3k
        auto &SuccInfo = NodeToInfo[Succ];
251
14.3k
        WorkList.push_back(Succ);
252
14.3k
        SuccInfo.Parent = LastNum;
253
14.3k
        SuccInfo.ReverseChildren.push_back(BB);
254
14.3k
      }
255
16.4k
    }
256
2.46k
257
2.46k
    return LastNum;
258
2.46k
  }
unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::runDFS<false, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::verifyParentProperty(llvm::DominatorTreeBase<llvm::BasicBlock, true> const&)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*)>(llvm::BasicBlock*, unsigned int, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::verifyParentProperty(llvm::DominatorTreeBase<llvm::BasicBlock, true> const&)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*), unsigned int)
Line
Count
Source
220
5.13k
                  unsigned AttachToNum) {
221
5.13k
    assert(V);
222
5.13k
    SmallVector<NodePtr, 64> WorkList = {V};
223
5.13k
    if (NodeToInfo.count(V) != 0) 
NodeToInfo[V].Parent = AttachToNum0
;
224
5.13k
225
20.3k
    while (!WorkList.empty()) {
226
15.1k
      const NodePtr BB = WorkList.pop_back_val();
227
15.1k
      auto &BBInfo = NodeToInfo[BB];
228
15.1k
229
15.1k
      // Visited nodes always have positive DFS numbers.
230
15.1k
      if (BBInfo.DFSNum != 0) 
continue435
;
231
14.7k
      BBInfo.DFSNum = BBInfo.Semi = ++LastNum;
232
14.7k
      BBInfo.Label = BB;
233
14.7k
      NumToNode.push_back(BB);
234
14.7k
235
14.7k
      constexpr bool Direction = IsReverse != IsPostDom;  // XOR.
236
14.7k
      for (const NodePtr Succ :
237
15.3k
           ChildrenGetter<Direction>::Get(BB, BatchUpdates)) {
238
15.3k
        const auto SIT = NodeToInfo.find(Succ);
239
15.3k
        // Don't visit nodes more than once but remember to collect
240
15.3k
        // ReverseChildren.
241
15.3k
        if (SIT != NodeToInfo.end() && 
SIT->second.DFSNum != 03.23k
) {
242
2.80k
          if (Succ != BB) 
SIT->second.ReverseChildren.push_back(BB)2.79k
;
243
2.80k
          continue;
244
2.80k
        }
245
12.5k
246
12.5k
        if (!Condition(BB, Succ)) 
continue2.49k
;
247
10.0k
248
10.0k
        // It's fine to add Succ to the map, because we know that it will be
249
10.0k
        // visited later.
250
10.0k
        auto &SuccInfo = NodeToInfo[Succ];
251
10.0k
        WorkList.push_back(Succ);
252
10.0k
        SuccInfo.Parent = LastNum;
253
10.0k
        SuccInfo.ReverseChildren.push_back(BB);
254
10.0k
      }
255
14.7k
    }
256
5.13k
257
5.13k
    return LastNum;
258
5.13k
  }
unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::runDFS<false, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::verifySiblingProperty(llvm::DominatorTreeBase<llvm::BasicBlock, true> const&)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*)>(llvm::BasicBlock*, unsigned int, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::verifySiblingProperty(llvm::DominatorTreeBase<llvm::BasicBlock, true> const&)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*), unsigned int)
Line
Count
Source
220
6.04k
                  unsigned AttachToNum) {
221
6.04k
    assert(V);
222
6.04k
    SmallVector<NodePtr, 64> WorkList = {V};
223
6.04k
    if (NodeToInfo.count(V) != 0) 
NodeToInfo[V].Parent = AttachToNum0
;
224
6.04k
225
26.7k
    while (!WorkList.empty()) {
226
20.7k
      const NodePtr BB = WorkList.pop_back_val();
227
20.7k
      auto &BBInfo = NodeToInfo[BB];
228
20.7k
229
20.7k
      // Visited nodes always have positive DFS numbers.
230
20.7k
      if (BBInfo.DFSNum != 0) 
continue807
;
231
19.9k
      BBInfo.DFSNum = BBInfo.Semi = ++LastNum;
232
19.9k
      BBInfo.Label = BB;
233
19.9k
      NumToNode.push_back(BB);
234
19.9k
235
19.9k
      constexpr bool Direction = IsReverse != IsPostDom;  // XOR.
236
19.9k
      for (const NodePtr Succ :
237
21.3k
           ChildrenGetter<Direction>::Get(BB, BatchUpdates)) {
238
21.3k
        const auto SIT = NodeToInfo.find(Succ);
239
21.3k
        // Don't visit nodes more than once but remember to collect
240
21.3k
        // ReverseChildren.
241
21.3k
        if (SIT != NodeToInfo.end() && 
SIT->second.DFSNum != 05.14k
) {
242
4.33k
          if (Succ != BB) 
SIT->second.ReverseChildren.push_back(BB)4.32k
;
243
4.33k
          continue;
244
4.33k
        }
245
17.0k
246
17.0k
        if (!Condition(BB, Succ)) 
continue2.35k
;
247
14.6k
248
14.6k
        // It's fine to add Succ to the map, because we know that it will be
249
14.6k
        // visited later.
250
14.6k
        auto &SuccInfo = NodeToInfo[Succ];
251
14.6k
        WorkList.push_back(Succ);
252
14.6k
        SuccInfo.Parent = LastNum;
253
14.6k
        SuccInfo.ReverseChildren.push_back(BB);
254
14.6k
      }
255
19.9k
    }
256
6.04k
257
6.04k
    return LastNum;
258
6.04k
  }
Unexecuted instantiation: unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::runDFS<true, bool (*)(llvm::BasicBlock*, llvm::BasicBlock*)>(llvm::BasicBlock*, unsigned int, bool (*)(llvm::BasicBlock*, llvm::BasicBlock*), unsigned int)
Unexecuted instantiation: unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::runDFS<false, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::DeleteUnreachable(llvm::DominatorTreeBase<llvm::BasicBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::BasicBlock>*)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*)>(llvm::BasicBlock*, unsigned int, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::DeleteUnreachable(llvm::DominatorTreeBase<llvm::BasicBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::BasicBlock>*)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*), unsigned int)
Unexecuted instantiation: unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::runDFS<false, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::DeleteUnreachable(llvm::DominatorTreeBase<llvm::BasicBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::BasicBlock>*)::'lambda0'(llvm::BasicBlock*, llvm::BasicBlock*)>(llvm::BasicBlock*, unsigned int, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::DeleteUnreachable(llvm::DominatorTreeBase<llvm::BasicBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::BasicBlock>*)::'lambda0'(llvm::BasicBlock*, llvm::BasicBlock*), unsigned int)
unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::runDFS<false, bool (*)(llvm::VPBlockBase*, llvm::VPBlockBase*)>(llvm::VPBlockBase*, unsigned int, bool (*)(llvm::VPBlockBase*, llvm::VPBlockBase*), unsigned int)
Line
Count
Source
220
28
                  unsigned AttachToNum) {
221
28
    assert(V);
222
28
    SmallVector<NodePtr, 64> WorkList = {V};
223
28
    if (NodeToInfo.count(V) != 0) 
NodeToInfo[V].Parent = AttachToNum0
;
224
28
225
170
    while (!WorkList.empty()) {
226
142
      const NodePtr BB = WorkList.pop_back_val();
227
142
      auto &BBInfo = NodeToInfo[BB];
228
142
229
142
      // Visited nodes always have positive DFS numbers.
230
142
      if (BBInfo.DFSNum != 0) 
continue7
;
231
135
      BBInfo.DFSNum = BBInfo.Semi = ++LastNum;
232
135
      BBInfo.Label = BB;
233
135
      NumToNode.push_back(BB);
234
135
235
135
      constexpr bool Direction = IsReverse != IsPostDom;  // XOR.
236
135
      for (const NodePtr Succ :
237
158
           ChildrenGetter<Direction>::Get(BB, BatchUpdates)) {
238
158
        const auto SIT = NodeToInfo.find(Succ);
239
158
        // Don't visit nodes more than once but remember to collect
240
158
        // ReverseChildren.
241
158
        if (SIT != NodeToInfo.end() && 
SIT->second.DFSNum != 051
) {
242
44
          if (Succ != BB) 
SIT->second.ReverseChildren.push_back(BB)25
;
243
44
          continue;
244
44
        }
245
114
246
114
        if (!Condition(BB, Succ)) 
continue0
;
247
114
248
114
        // It's fine to add Succ to the map, because we know that it will be
249
114
        // visited later.
250
114
        auto &SuccInfo = NodeToInfo[Succ];
251
114
        WorkList.push_back(Succ);
252
114
        SuccInfo.Parent = LastNum;
253
114
        SuccInfo.ReverseChildren.push_back(BB);
254
114
      }
255
135
    }
256
28
257
28
    return LastNum;
258
28
  }
Unexecuted instantiation: unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::runDFS<true, bool (*)(llvm::VPBlockBase*, llvm::VPBlockBase*)>(llvm::VPBlockBase*, unsigned int, bool (*)(llvm::VPBlockBase*, llvm::VPBlockBase*), unsigned int)
unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, false> >::runDFS<false, bool (*)(clang::CFGBlock*, clang::CFGBlock*)>(clang::CFGBlock*, unsigned int, bool (*)(clang::CFGBlock*, clang::CFGBlock*), unsigned int)
Line
Count
Source
220
8
                  unsigned AttachToNum) {
221
8
    assert(V);
222
8
    SmallVector<NodePtr, 64> WorkList = {V};
223
8
    if (NodeToInfo.count(V) != 0) 
NodeToInfo[V].Parent = AttachToNum0
;
224
8
225
77
    while (!WorkList.empty()) {
226
69
      const NodePtr BB = WorkList.pop_back_val();
227
69
      auto &BBInfo = NodeToInfo[BB];
228
69
229
69
      // Visited nodes always have positive DFS numbers.
230
69
      if (BBInfo.DFSNum != 0) 
continue3
;
231
66
      BBInfo.DFSNum = BBInfo.Semi = ++LastNum;
232
66
      BBInfo.Label = BB;
233
66
      NumToNode.push_back(BB);
234
66
235
66
      constexpr bool Direction = IsReverse != IsPostDom;  // XOR.
236
66
      for (const NodePtr Succ :
237
74
           ChildrenGetter<Direction>::Get(BB, BatchUpdates)) {
238
74
        const auto SIT = NodeToInfo.find(Succ);
239
74
        // Don't visit nodes more than once but remember to collect
240
74
        // ReverseChildren.
241
74
        if (SIT != NodeToInfo.end() && 
SIT->second.DFSNum != 016
) {
242
13
          if (Succ != BB) SIT->second.ReverseChildren.push_back(BB);
243
13
          continue;
244
13
        }
245
61
246
61
        if (!Condition(BB, Succ)) 
continue0
;
247
61
248
61
        // It's fine to add Succ to the map, because we know that it will be
249
61
        // visited later.
250
61
        auto &SuccInfo = NodeToInfo[Succ];
251
61
        WorkList.push_back(Succ);
252
61
        SuccInfo.Parent = LastNum;
253
61
        SuccInfo.ReverseChildren.push_back(BB);
254
61
      }
255
66
    }
256
8
257
8
    return LastNum;
258
8
  }
unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, true> >::runDFS<false, bool (*)(clang::CFGBlock*, clang::CFGBlock*)>(clang::CFGBlock*, unsigned int, bool (*)(clang::CFGBlock*, clang::CFGBlock*), unsigned int)
Line
Count
Source
220
214
                  unsigned AttachToNum) {
221
214
    assert(V);
222
214
    SmallVector<NodePtr, 64> WorkList = {V};
223
214
    if (NodeToInfo.count(V) != 0) 
NodeToInfo[V].Parent = AttachToNum0
;
224
214
225
1.31k
    while (!WorkList.empty()) {
226
1.09k
      const NodePtr BB = WorkList.pop_back_val();
227
1.09k
      auto &BBInfo = NodeToInfo[BB];
228
1.09k
229
1.09k
      // Visited nodes always have positive DFS numbers.
230
1.09k
      if (BBInfo.DFSNum != 0) 
continue0
;
231
1.09k
      BBInfo.DFSNum = BBInfo.Semi = ++LastNum;
232
1.09k
      BBInfo.Label = BB;
233
1.09k
      NumToNode.push_back(BB);
234
1.09k
235
1.09k
      constexpr bool Direction = IsReverse != IsPostDom;  // XOR.
236
1.09k
      for (const NodePtr Succ :
237
1.17k
           ChildrenGetter<Direction>::Get(BB, BatchUpdates)) {
238
1.17k
        const auto SIT = NodeToInfo.find(Succ);
239
1.17k
        // Don't visit nodes more than once but remember to collect
240
1.17k
        // ReverseChildren.
241
1.17k
        if (SIT != NodeToInfo.end() && 
SIT->second.DFSNum != 0294
) {
242
294
          if (Succ != BB) SIT->second.ReverseChildren.push_back(BB);
243
294
          continue;
244
294
        }
245
884
246
884
        if (!Condition(BB, Succ)) 
continue0
;
247
884
248
884
        // It's fine to add Succ to the map, because we know that it will be
249
884
        // visited later.
250
884
        auto &SuccInfo = NodeToInfo[Succ];
251
884
        WorkList.push_back(Succ);
252
884
        SuccInfo.Parent = LastNum;
253
884
        SuccInfo.ReverseChildren.push_back(BB);
254
884
      }
255
1.09k
    }
256
214
257
214
    return LastNum;
258
214
  }
Unexecuted instantiation: unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, true> >::runDFS<true, bool (*)(clang::CFGBlock*, clang::CFGBlock*)>(clang::CFGBlock*, unsigned int, bool (*)(clang::CFGBlock*, clang::CFGBlock*), unsigned int)
Unexecuted instantiation: unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, false> >::runDFS<true, bool (*)(clang::CFGBlock*, clang::CFGBlock*)>(clang::CFGBlock*, unsigned int, bool (*)(clang::CFGBlock*, clang::CFGBlock*), unsigned int)
259
260
  // V is a predecessor of W. eval() returns V if V < W, otherwise the minimum
261
  // of sdom(U), where U > W and there is a virtual forest path from U to V. The
262
  // virtual forest consists of linked edges of processed vertices.
263
  //
264
  // We can follow Parent pointers (virtual forest edges) to determine the
265
  // ancestor U with minimum sdom(U). But it is slow and thus we employ the path
266
  // compression technique to speed up to O(m*log(n)). Theoretically the virtual
267
  // forest can be organized as balanced trees to achieve almost linear
268
  // O(m*alpha(m,n)) running time. But it requires two auxiliary arrays (Size
269
  // and Child) and is unlikely to be faster than the simple implementation.
270
  //
271
  // For each vertex V, its Label points to the vertex with the minimal sdom(U)
272
  // (Semi) in its path from V (included) to NodeToInfo[V].Parent (excluded).
273
  NodePtr eval(NodePtr V, unsigned LastLinked,
274
124M
               SmallVectorImpl<InfoRec *> &Stack) {
275
124M
    InfoRec *VInfo = &NodeToInfo[V];
276
124M
    if (VInfo->Parent < LastLinked)
277
106M
      return VInfo->Label;
278
17.3M
279
17.3M
    // Store ancestors except the last (root of a virtual tree) into a stack.
280
17.3M
    assert(Stack.empty());
281
42.5M
    do {
282
42.5M
      Stack.push_back(VInfo);
283
42.5M
      VInfo = &NodeToInfo[NumToNode[VInfo->Parent]];
284
42.5M
    } while (VInfo->Parent >= LastLinked);
285
17.3M
286
17.3M
    // Path compression. Point each vertex's Parent to the root and update its
287
17.3M
    // Label if any of its ancestors (PInfo->Label) has a smaller Semi.
288
17.3M
    const InfoRec *PInfo = VInfo;
289
17.3M
    const InfoRec *PLabelInfo = &NodeToInfo[PInfo->Label];
290
42.5M
    do {
291
42.5M
      VInfo = Stack.pop_back_val();
292
42.5M
      VInfo->Parent = PInfo->Parent;
293
42.5M
      const InfoRec *VLabelInfo = &NodeToInfo[VInfo->Label];
294
42.5M
      if (PLabelInfo->Semi < VLabelInfo->Semi)
295
40.2M
        VInfo->Label = PInfo->Label;
296
2.34M
      else
297
2.34M
        PLabelInfo = VLabelInfo;
298
42.5M
      PInfo = VInfo;
299
42.5M
    } while (!Stack.empty());
300
17.3M
    return VInfo->Label;
301
17.3M
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::eval(llvm::MachineBasicBlock*, unsigned int, llvm::SmallVectorImpl<llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::InfoRec*>&)
Line
Count
Source
274
13.7M
               SmallVectorImpl<InfoRec *> &Stack) {
275
13.7M
    InfoRec *VInfo = &NodeToInfo[V];
276
13.7M
    if (VInfo->Parent < LastLinked)
277
11.7M
      return VInfo->Label;
278
2.01M
279
2.01M
    // Store ancestors except the last (root of a virtual tree) into a stack.
280
2.01M
    assert(Stack.empty());
281
4.95M
    do {
282
4.95M
      Stack.push_back(VInfo);
283
4.95M
      VInfo = &NodeToInfo[NumToNode[VInfo->Parent]];
284
4.95M
    } while (VInfo->Parent >= LastLinked);
285
2.01M
286
2.01M
    // Path compression. Point each vertex's Parent to the root and update its
287
2.01M
    // Label if any of its ancestors (PInfo->Label) has a smaller Semi.
288
2.01M
    const InfoRec *PInfo = VInfo;
289
2.01M
    const InfoRec *PLabelInfo = &NodeToInfo[PInfo->Label];
290
4.95M
    do {
291
4.95M
      VInfo = Stack.pop_back_val();
292
4.95M
      VInfo->Parent = PInfo->Parent;
293
4.95M
      const InfoRec *VLabelInfo = &NodeToInfo[VInfo->Label];
294
4.95M
      if (PLabelInfo->Semi < VLabelInfo->Semi)
295
4.79M
        VInfo->Label = PInfo->Label;
296
157k
      else
297
157k
        PLabelInfo = VLabelInfo;
298
4.95M
      PInfo = VInfo;
299
4.95M
    } while (!Stack.empty());
300
2.01M
    return VInfo->Label;
301
2.01M
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::eval(llvm::MachineBasicBlock*, unsigned int, llvm::SmallVectorImpl<llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::InfoRec*>&)
Line
Count
Source
274
10.2M
               SmallVectorImpl<InfoRec *> &Stack) {
275
10.2M
    InfoRec *VInfo = &NodeToInfo[V];
276
10.2M
    if (VInfo->Parent < LastLinked)
277
9.33M
      return VInfo->Label;
278
940k
279
940k
    // Store ancestors except the last (root of a virtual tree) into a stack.
280
940k
    assert(Stack.empty());
281
3.01M
    do {
282
3.01M
      Stack.push_back(VInfo);
283
3.01M
      VInfo = &NodeToInfo[NumToNode[VInfo->Parent]];
284
3.01M
    } while (VInfo->Parent >= LastLinked);
285
940k
286
940k
    // Path compression. Point each vertex's Parent to the root and update its
287
940k
    // Label if any of its ancestors (PInfo->Label) has a smaller Semi.
288
940k
    const InfoRec *PInfo = VInfo;
289
940k
    const InfoRec *PLabelInfo = &NodeToInfo[PInfo->Label];
290
3.01M
    do {
291
3.01M
      VInfo = Stack.pop_back_val();
292
3.01M
      VInfo->Parent = PInfo->Parent;
293
3.01M
      const InfoRec *VLabelInfo = &NodeToInfo[VInfo->Label];
294
3.01M
      if (PLabelInfo->Semi < VLabelInfo->Semi)
295
2.05M
        VInfo->Label = PInfo->Label;
296
966k
      else
297
966k
        PLabelInfo = VLabelInfo;
298
3.01M
      PInfo = VInfo;
299
3.01M
    } while (!Stack.empty());
300
940k
    return VInfo->Label;
301
940k
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::eval(llvm::BasicBlock*, unsigned int, llvm::SmallVectorImpl<llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::InfoRec*>&)
Line
Count
Source
274
96.4M
               SmallVectorImpl<InfoRec *> &Stack) {
275
96.4M
    InfoRec *VInfo = &NodeToInfo[V];
276
96.4M
    if (VInfo->Parent < LastLinked)
277
82.5M
      return VInfo->Label;
278
13.9M
279
13.9M
    // Store ancestors except the last (root of a virtual tree) into a stack.
280
13.9M
    assert(Stack.empty());
281
33.4M
    do {
282
33.4M
      Stack.push_back(VInfo);
283
33.4M
      VInfo = &NodeToInfo[NumToNode[VInfo->Parent]];
284
33.4M
    } while (VInfo->Parent >= LastLinked);
285
13.9M
286
13.9M
    // Path compression. Point each vertex's Parent to the root and update its
287
13.9M
    // Label if any of its ancestors (PInfo->Label) has a smaller Semi.
288
13.9M
    const InfoRec *PInfo = VInfo;
289
13.9M
    const InfoRec *PLabelInfo = &NodeToInfo[PInfo->Label];
290
33.4M
    do {
291
33.4M
      VInfo = Stack.pop_back_val();
292
33.4M
      VInfo->Parent = PInfo->Parent;
293
33.4M
      const InfoRec *VLabelInfo = &NodeToInfo[VInfo->Label];
294
33.4M
      if (PLabelInfo->Semi < VLabelInfo->Semi)
295
32.6M
        VInfo->Label = PInfo->Label;
296
850k
      else
297
850k
        PLabelInfo = VLabelInfo;
298
33.4M
      PInfo = VInfo;
299
33.4M
    } while (!Stack.empty());
300
13.9M
    return VInfo->Label;
301
13.9M
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::eval(llvm::BasicBlock*, unsigned int, llvm::SmallVectorImpl<llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::InfoRec*>&)
Line
Count
Source
274
3.67M
               SmallVectorImpl<InfoRec *> &Stack) {
275
3.67M
    InfoRec *VInfo = &NodeToInfo[V];
276
3.67M
    if (VInfo->Parent < LastLinked)
277
3.17M
      return VInfo->Label;
278
493k
279
493k
    // Store ancestors except the last (root of a virtual tree) into a stack.
280
493k
    assert(Stack.empty());
281
1.07M
    do {
282
1.07M
      Stack.push_back(VInfo);
283
1.07M
      VInfo = &NodeToInfo[NumToNode[VInfo->Parent]];
284
1.07M
    } while (VInfo->Parent >= LastLinked);
285
493k
286
493k
    // Path compression. Point each vertex's Parent to the root and update its
287
493k
    // Label if any of its ancestors (PInfo->Label) has a smaller Semi.
288
493k
    const InfoRec *PInfo = VInfo;
289
493k
    const InfoRec *PLabelInfo = &NodeToInfo[PInfo->Label];
290
1.07M
    do {
291
1.07M
      VInfo = Stack.pop_back_val();
292
1.07M
      VInfo->Parent = PInfo->Parent;
293
1.07M
      const InfoRec *VLabelInfo = &NodeToInfo[VInfo->Label];
294
1.07M
      if (PLabelInfo->Semi < VLabelInfo->Semi)
295
713k
        VInfo->Label = PInfo->Label;
296
366k
      else
297
366k
        PLabelInfo = VLabelInfo;
298
1.07M
      PInfo = VInfo;
299
1.07M
    } while (!Stack.empty());
300
493k
    return VInfo->Label;
301
493k
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::eval(llvm::VPBlockBase*, unsigned int, llvm::SmallVectorImpl<llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::InfoRec*>&)
Line
Count
Source
274
139
               SmallVectorImpl<InfoRec *> &Stack) {
275
139
    InfoRec *VInfo = &NodeToInfo[V];
276
139
    if (VInfo->Parent < LastLinked)
277
121
      return VInfo->Label;
278
18
279
18
    // Store ancestors except the last (root of a virtual tree) into a stack.
280
18
    assert(Stack.empty());
281
30
    do {
282
30
      Stack.push_back(VInfo);
283
30
      VInfo = &NodeToInfo[NumToNode[VInfo->Parent]];
284
30
    } while (VInfo->Parent >= LastLinked);
285
18
286
18
    // Path compression. Point each vertex's Parent to the root and update its
287
18
    // Label if any of its ancestors (PInfo->Label) has a smaller Semi.
288
18
    const InfoRec *PInfo = VInfo;
289
18
    const InfoRec *PLabelInfo = &NodeToInfo[PInfo->Label];
290
30
    do {
291
30
      VInfo = Stack.pop_back_val();
292
30
      VInfo->Parent = PInfo->Parent;
293
30
      const InfoRec *VLabelInfo = &NodeToInfo[VInfo->Label];
294
30
      if (PLabelInfo->Semi < VLabelInfo->Semi)
295
22
        VInfo->Label = PInfo->Label;
296
8
      else
297
8
        PLabelInfo = VLabelInfo;
298
30
      PInfo = VInfo;
299
30
    } while (!Stack.empty());
300
18
    return VInfo->Label;
301
18
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, false> >::eval(clang::CFGBlock*, unsigned int, llvm::SmallVectorImpl<llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, false> >::InfoRec*>&)
Line
Count
Source
274
74
               SmallVectorImpl<InfoRec *> &Stack) {
275
74
    InfoRec *VInfo = &NodeToInfo[V];
276
74
    if (VInfo->Parent < LastLinked)
277
67
      return VInfo->Label;
278
7
279
7
    // Store ancestors except the last (root of a virtual tree) into a stack.
280
7
    assert(Stack.empty());
281
10
    do {
282
10
      Stack.push_back(VInfo);
283
10
      VInfo = &NodeToInfo[NumToNode[VInfo->Parent]];
284
10
    } while (VInfo->Parent >= LastLinked);
285
7
286
7
    // Path compression. Point each vertex's Parent to the root and update its
287
7
    // Label if any of its ancestors (PInfo->Label) has a smaller Semi.
288
7
    const InfoRec *PInfo = VInfo;
289
7
    const InfoRec *PLabelInfo = &NodeToInfo[PInfo->Label];
290
10
    do {
291
10
      VInfo = Stack.pop_back_val();
292
10
      VInfo->Parent = PInfo->Parent;
293
10
      const InfoRec *VLabelInfo = &NodeToInfo[VInfo->Label];
294
10
      if (PLabelInfo->Semi < VLabelInfo->Semi)
295
10
        VInfo->Label = PInfo->Label;
296
0
      else
297
0
        PLabelInfo = VLabelInfo;
298
10
      PInfo = VInfo;
299
10
    } while (!Stack.empty());
300
7
    return VInfo->Label;
301
7
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, true> >::eval(clang::CFGBlock*, unsigned int, llvm::SmallVectorImpl<llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, true> >::InfoRec*>&)
Line
Count
Source
274
589
               SmallVectorImpl<InfoRec *> &Stack) {
275
589
    InfoRec *VInfo = &NodeToInfo[V];
276
589
    if (VInfo->Parent < LastLinked)
277
570
      return VInfo->Label;
278
19
279
19
    // Store ancestors except the last (root of a virtual tree) into a stack.
280
19
    assert(Stack.empty());
281
25
    do {
282
25
      Stack.push_back(VInfo);
283
25
      VInfo = &NodeToInfo[NumToNode[VInfo->Parent]];
284
25
    } while (VInfo->Parent >= LastLinked);
285
19
286
19
    // Path compression. Point each vertex's Parent to the root and update its
287
19
    // Label if any of its ancestors (PInfo->Label) has a smaller Semi.
288
19
    const InfoRec *PInfo = VInfo;
289
19
    const InfoRec *PLabelInfo = &NodeToInfo[PInfo->Label];
290
25
    do {
291
25
      VInfo = Stack.pop_back_val();
292
25
      VInfo->Parent = PInfo->Parent;
293
25
      const InfoRec *VLabelInfo = &NodeToInfo[VInfo->Label];
294
25
      if (PLabelInfo->Semi < VLabelInfo->Semi)
295
25
        VInfo->Label = PInfo->Label;
296
0
      else
297
0
        PLabelInfo = VLabelInfo;
298
25
      PInfo = VInfo;
299
25
    } while (!Stack.empty());
300
19
    return VInfo->Label;
301
19
  }
302
303
  // This function requires DFS to be run before calling it.
304
15.6M
  void runSemiNCA(DomTreeT &DT, const unsigned MinLevel = 0) {
305
15.6M
    const unsigned NextDFSNum(NumToNode.size());
306
15.6M
    // Initialize IDoms to spanning tree parents.
307
119M
    for (unsigned i = 1; i < NextDFSNum; 
++i103M
) {
308
103M
      const NodePtr V = NumToNode[i];
309
103M
      auto &VInfo = NodeToInfo[V];
310
103M
      VInfo.IDom = NumToNode[VInfo.Parent];
311
103M
    }
312
15.6M
313
15.6M
    // Step #1: Calculate the semidominators of all vertices.
314
15.6M
    SmallVector<InfoRec *, 32> EvalStack;
315
103M
    for (unsigned i = NextDFSNum - 1; i >= 2; 
--i87.9M
) {
316
87.9M
      NodePtr W = NumToNode[i];
317
87.9M
      auto &WInfo = NodeToInfo[W];
318
87.9M
319
87.9M
      // Initialize the semi dominator to point to the parent node.
320
87.9M
      WInfo.Semi = WInfo.Parent;
321
124M
      for (const auto &N : WInfo.ReverseChildren) {
322
124M
        if (NodeToInfo.count(N) == 0)  // Skip unreachable predecessors.
323
0
          continue;
324
124M
325
124M
        const TreeNodePtr TN = DT.getNode(N);
326
124M
        // Skip predecessors whose level is above the subtree we are processing.
327
124M
        if (TN && 
TN->getLevel() < MinLevel15.5M
)
328
0
          continue;
329
124M
330
124M
        unsigned SemiU = NodeToInfo[eval(N, i + 1, EvalStack)].Semi;
331
124M
        if (SemiU < WInfo.Semi) 
WInfo.Semi = SemiU14.9M
;
332
124M
      }
333
87.9M
    }
334
15.6M
335
15.6M
    // Step #2: Explicitly define the immediate dominator of each vertex.
336
15.6M
    //          IDom[i] = NCA(SDom[i], SpanningTreeParent(i)).
337
15.6M
    // Note that the parents were stored in IDoms and later got invalidated
338
15.6M
    // during path compression in Eval.
339
103M
    for (unsigned i = 2; i < NextDFSNum; 
++i87.9M
) {
340
87.9M
      const NodePtr W = NumToNode[i];
341
87.9M
      auto &WInfo = NodeToInfo[W];
342
87.9M
      const unsigned SDomNum = NodeToInfo[NumToNode[WInfo.Semi]].DFSNum;
343
87.9M
      NodePtr WIDomCandidate = WInfo.IDom;
344
114M
      while (NodeToInfo[WIDomCandidate].DFSNum > SDomNum)
345
26.3M
        WIDomCandidate = NodeToInfo[WIDomCandidate].IDom;
346
87.9M
347
87.9M
      WInfo.IDom = WIDomCandidate;
348
87.9M
    }
349
15.6M
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::runSemiNCA(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false>&, unsigned int)
Line
Count
Source
304
2.61M
  void runSemiNCA(DomTreeT &DT, const unsigned MinLevel = 0) {
305
2.61M
    const unsigned NextDFSNum(NumToNode.size());
306
2.61M
    // Initialize IDoms to spanning tree parents.
307
14.6M
    for (unsigned i = 1; i < NextDFSNum; 
++i12.0M
) {
308
12.0M
      const NodePtr V = NumToNode[i];
309
12.0M
      auto &VInfo = NodeToInfo[V];
310
12.0M
      VInfo.IDom = NumToNode[VInfo.Parent];
311
12.0M
    }
312
2.61M
313
2.61M
    // Step #1: Calculate the semidominators of all vertices.
314
2.61M
    SmallVector<InfoRec *, 32> EvalStack;
315
12.0M
    for (unsigned i = NextDFSNum - 1; i >= 2; 
--i9.38M
) {
316
9.38M
      NodePtr W = NumToNode[i];
317
9.38M
      auto &WInfo = NodeToInfo[W];
318
9.38M
319
9.38M
      // Initialize the semi dominator to point to the parent node.
320
9.38M
      WInfo.Semi = WInfo.Parent;
321
13.7M
      for (const auto &N : WInfo.ReverseChildren) {
322
13.7M
        if (NodeToInfo.count(N) == 0)  // Skip unreachable predecessors.
323
0
          continue;
324
13.7M
325
13.7M
        const TreeNodePtr TN = DT.getNode(N);
326
13.7M
        // Skip predecessors whose level is above the subtree we are processing.
327
13.7M
        if (TN && 
TN->getLevel() < MinLevel0
)
328
0
          continue;
329
13.7M
330
13.7M
        unsigned SemiU = NodeToInfo[eval(N, i + 1, EvalStack)].Semi;
331
13.7M
        if (SemiU < WInfo.Semi) 
WInfo.Semi = SemiU1.60M
;
332
13.7M
      }
333
9.38M
    }
334
2.61M
335
2.61M
    // Step #2: Explicitly define the immediate dominator of each vertex.
336
2.61M
    //          IDom[i] = NCA(SDom[i], SpanningTreeParent(i)).
337
2.61M
    // Note that the parents were stored in IDoms and later got invalidated
338
2.61M
    // during path compression in Eval.
339
12.0M
    for (unsigned i = 2; i < NextDFSNum; 
++i9.38M
) {
340
9.38M
      const NodePtr W = NumToNode[i];
341
9.38M
      auto &WInfo = NodeToInfo[W];
342
9.38M
      const unsigned SDomNum = NodeToInfo[NumToNode[WInfo.Semi]].DFSNum;
343
9.38M
      NodePtr WIDomCandidate = WInfo.IDom;
344
12.2M
      while (NodeToInfo[WIDomCandidate].DFSNum > SDomNum)
345
2.84M
        WIDomCandidate = NodeToInfo[WIDomCandidate].IDom;
346
9.38M
347
9.38M
      WInfo.IDom = WIDomCandidate;
348
9.38M
    }
349
2.61M
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::runSemiNCA(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true>&, unsigned int)
Line
Count
Source
304
1.50M
  void runSemiNCA(DomTreeT &DT, const unsigned MinLevel = 0) {
305
1.50M
    const unsigned NextDFSNum(NumToNode.size());
306
1.50M
    // Initialize IDoms to spanning tree parents.
307
11.5M
    for (unsigned i = 1; i < NextDFSNum; 
++i10.0M
) {
308
10.0M
      const NodePtr V = NumToNode[i];
309
10.0M
      auto &VInfo = NodeToInfo[V];
310
10.0M
      VInfo.IDom = NumToNode[VInfo.Parent];
311
10.0M
    }
312
1.50M
313
1.50M
    // Step #1: Calculate the semidominators of all vertices.
314
1.50M
    SmallVector<InfoRec *, 32> EvalStack;
315
10.0M
    for (unsigned i = NextDFSNum - 1; i >= 2; 
--i8.52M
) {
316
8.52M
      NodePtr W = NumToNode[i];
317
8.52M
      auto &WInfo = NodeToInfo[W];
318
8.52M
319
8.52M
      // Initialize the semi dominator to point to the parent node.
320
8.52M
      WInfo.Semi = WInfo.Parent;
321
10.2M
      for (const auto &N : WInfo.ReverseChildren) {
322
10.2M
        if (NodeToInfo.count(N) == 0)  // Skip unreachable predecessors.
323
0
          continue;
324
10.2M
325
10.2M
        const TreeNodePtr TN = DT.getNode(N);
326
10.2M
        // Skip predecessors whose level is above the subtree we are processing.
327
10.2M
        if (TN && 
TN->getLevel() < MinLevel0
)
328
0
          continue;
329
10.2M
330
10.2M
        unsigned SemiU = NodeToInfo[eval(N, i + 1, EvalStack)].Semi;
331
10.2M
        if (SemiU < WInfo.Semi) 
WInfo.Semi = SemiU3.37M
;
332
10.2M
      }
333
8.52M
    }
334
1.50M
335
1.50M
    // Step #2: Explicitly define the immediate dominator of each vertex.
336
1.50M
    //          IDom[i] = NCA(SDom[i], SpanningTreeParent(i)).
337
1.50M
    // Note that the parents were stored in IDoms and later got invalidated
338
1.50M
    // during path compression in Eval.
339
10.0M
    for (unsigned i = 2; i < NextDFSNum; 
++i8.52M
) {
340
8.52M
      const NodePtr W = NumToNode[i];
341
8.52M
      auto &WInfo = NodeToInfo[W];
342
8.52M
      const unsigned SDomNum = NodeToInfo[NumToNode[WInfo.Semi]].DFSNum;
343
8.52M
      NodePtr WIDomCandidate = WInfo.IDom;
344
13.2M
      while (NodeToInfo[WIDomCandidate].DFSNum > SDomNum)
345
4.70M
        WIDomCandidate = NodeToInfo[WIDomCandidate].IDom;
346
8.52M
347
8.52M
      WInfo.IDom = WIDomCandidate;
348
8.52M
    }
349
1.50M
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::runSemiNCA(llvm::DominatorTreeBase<llvm::BasicBlock, false>&, unsigned int)
Line
Count
Source
304
10.9M
  void runSemiNCA(DomTreeT &DT, const unsigned MinLevel = 0) {
305
10.9M
    const unsigned NextDFSNum(NumToNode.size());
306
10.9M
    // Initialize IDoms to spanning tree parents.
307
88.7M
    for (unsigned i = 1; i < NextDFSNum; 
++i77.8M
) {
308
77.8M
      const NodePtr V = NumToNode[i];
309
77.8M
      auto &VInfo = NodeToInfo[V];
310
77.8M
      VInfo.IDom = NumToNode[VInfo.Parent];
311
77.8M
    }
312
10.9M
313
10.9M
    // Step #1: Calculate the semidominators of all vertices.
314
10.9M
    SmallVector<InfoRec *, 32> EvalStack;
315
77.8M
    for (unsigned i = NextDFSNum - 1; i >= 2; 
--i66.9M
) {
316
66.9M
      NodePtr W = NumToNode[i];
317
66.9M
      auto &WInfo = NodeToInfo[W];
318
66.9M
319
66.9M
      // Initialize the semi dominator to point to the parent node.
320
66.9M
      WInfo.Semi = WInfo.Parent;
321
96.4M
      for (const auto &N : WInfo.ReverseChildren) {
322
96.4M
        if (NodeToInfo.count(N) == 0)  // Skip unreachable predecessors.
323
0
          continue;
324
96.4M
325
96.4M
        const TreeNodePtr TN = DT.getNode(N);
326
96.4M
        // Skip predecessors whose level is above the subtree we are processing.
327
96.4M
        if (TN && 
TN->getLevel() < MinLevel15.5M
)
328
0
          continue;
329
96.4M
330
96.4M
        unsigned SemiU = NodeToInfo[eval(N, i + 1, EvalStack)].Semi;
331
96.4M
        if (SemiU < WInfo.Semi) 
WInfo.Semi = SemiU9.19M
;
332
96.4M
      }
333
66.9M
    }
334
10.9M
335
10.9M
    // Step #2: Explicitly define the immediate dominator of each vertex.
336
10.9M
    //          IDom[i] = NCA(SDom[i], SpanningTreeParent(i)).
337
10.9M
    // Note that the parents were stored in IDoms and later got invalidated
338
10.9M
    // during path compression in Eval.
339
77.8M
    for (unsigned i = 2; i < NextDFSNum; 
++i66.9M
) {
340
66.9M
      const NodePtr W = NumToNode[i];
341
66.9M
      auto &WInfo = NodeToInfo[W];
342
66.9M
      const unsigned SDomNum = NodeToInfo[NumToNode[WInfo.Semi]].DFSNum;
343
66.9M
      NodePtr WIDomCandidate = WInfo.IDom;
344
84.7M
      while (NodeToInfo[WIDomCandidate].DFSNum > SDomNum)
345
17.8M
        WIDomCandidate = NodeToInfo[WIDomCandidate].IDom;
346
66.9M
347
66.9M
      WInfo.IDom = WIDomCandidate;
348
66.9M
    }
349
10.9M
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::runSemiNCA(llvm::DominatorTreeBase<llvm::BasicBlock, true>&, unsigned int)
Line
Count
Source
304
605k
  void runSemiNCA(DomTreeT &DT, const unsigned MinLevel = 0) {
305
605k
    const unsigned NextDFSNum(NumToNode.size());
306
605k
    // Initialize IDoms to spanning tree parents.
307
4.27M
    for (unsigned i = 1; i < NextDFSNum; 
++i3.66M
) {
308
3.66M
      const NodePtr V = NumToNode[i];
309
3.66M
      auto &VInfo = NodeToInfo[V];
310
3.66M
      VInfo.IDom = NumToNode[VInfo.Parent];
311
3.66M
    }
312
605k
313
605k
    // Step #1: Calculate the semidominators of all vertices.
314
605k
    SmallVector<InfoRec *, 32> EvalStack;
315
3.66M
    for (unsigned i = NextDFSNum - 1; i >= 2; 
--i3.06M
) {
316
3.06M
      NodePtr W = NumToNode[i];
317
3.06M
      auto &WInfo = NodeToInfo[W];
318
3.06M
319
3.06M
      // Initialize the semi dominator to point to the parent node.
320
3.06M
      WInfo.Semi = WInfo.Parent;
321
3.67M
      for (const auto &N : WInfo.ReverseChildren) {
322
3.67M
        if (NodeToInfo.count(N) == 0)  // Skip unreachable predecessors.
323
0
          continue;
324
3.67M
325
3.67M
        const TreeNodePtr TN = DT.getNode(N);
326
3.67M
        // Skip predecessors whose level is above the subtree we are processing.
327
3.67M
        if (TN && 
TN->getLevel() < MinLevel308
)
328
0
          continue;
329
3.67M
330
3.67M
        unsigned SemiU = NodeToInfo[eval(N, i + 1, EvalStack)].Semi;
331
3.67M
        if (SemiU < WInfo.Semi) 
WInfo.Semi = SemiU792k
;
332
3.67M
      }
333
3.06M
    }
334
605k
335
605k
    // Step #2: Explicitly define the immediate dominator of each vertex.
336
605k
    //          IDom[i] = NCA(SDom[i], SpanningTreeParent(i)).
337
605k
    // Note that the parents were stored in IDoms and later got invalidated
338
605k
    // during path compression in Eval.
339
3.66M
    for (unsigned i = 2; i < NextDFSNum; 
++i3.06M
) {
340
3.06M
      const NodePtr W = NumToNode[i];
341
3.06M
      auto &WInfo = NodeToInfo[W];
342
3.06M
      const unsigned SDomNum = NodeToInfo[NumToNode[WInfo.Semi]].DFSNum;
343
3.06M
      NodePtr WIDomCandidate = WInfo.IDom;
344
4.05M
      while (NodeToInfo[WIDomCandidate].DFSNum > SDomNum)
345
992k
        WIDomCandidate = NodeToInfo[WIDomCandidate].IDom;
346
3.06M
347
3.06M
      WInfo.IDom = WIDomCandidate;
348
3.06M
    }
349
605k
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::runSemiNCA(llvm::DominatorTreeBase<llvm::VPBlockBase, false>&, unsigned int)
Line
Count
Source
304
28
  void runSemiNCA(DomTreeT &DT, const unsigned MinLevel = 0) {
305
28
    const unsigned NextDFSNum(NumToNode.size());
306
28
    // Initialize IDoms to spanning tree parents.
307
163
    for (unsigned i = 1; i < NextDFSNum; 
++i135
) {
308
135
      const NodePtr V = NumToNode[i];
309
135
      auto &VInfo = NodeToInfo[V];
310
135
      VInfo.IDom = NumToNode[VInfo.Parent];
311
135
    }
312
28
313
28
    // Step #1: Calculate the semidominators of all vertices.
314
28
    SmallVector<InfoRec *, 32> EvalStack;
315
135
    for (unsigned i = NextDFSNum - 1; i >= 2; 
--i107
) {
316
107
      NodePtr W = NumToNode[i];
317
107
      auto &WInfo = NodeToInfo[W];
318
107
319
107
      // Initialize the semi dominator to point to the parent node.
320
107
      WInfo.Semi = WInfo.Parent;
321
139
      for (const auto &N : WInfo.ReverseChildren) {
322
139
        if (NodeToInfo.count(N) == 0)  // Skip unreachable predecessors.
323
0
          continue;
324
139
325
139
        const TreeNodePtr TN = DT.getNode(N);
326
139
        // Skip predecessors whose level is above the subtree we are processing.
327
139
        if (TN && 
TN->getLevel() < MinLevel0
)
328
0
          continue;
329
139
330
139
        unsigned SemiU = NodeToInfo[eval(N, i + 1, EvalStack)].Semi;
331
139
        if (SemiU < WInfo.Semi) 
WInfo.Semi = SemiU10
;
332
139
      }
333
107
    }
334
28
335
28
    // Step #2: Explicitly define the immediate dominator of each vertex.
336
28
    //          IDom[i] = NCA(SDom[i], SpanningTreeParent(i)).
337
28
    // Note that the parents were stored in IDoms and later got invalidated
338
28
    // during path compression in Eval.
339
135
    for (unsigned i = 2; i < NextDFSNum; 
++i107
) {
340
107
      const NodePtr W = NumToNode[i];
341
107
      auto &WInfo = NodeToInfo[W];
342
107
      const unsigned SDomNum = NodeToInfo[NumToNode[WInfo.Semi]].DFSNum;
343
107
      NodePtr WIDomCandidate = WInfo.IDom;
344
123
      while (NodeToInfo[WIDomCandidate].DFSNum > SDomNum)
345
16
        WIDomCandidate = NodeToInfo[WIDomCandidate].IDom;
346
107
347
107
      WInfo.IDom = WIDomCandidate;
348
107
    }
349
28
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, false> >::runSemiNCA(llvm::DominatorTreeBase<clang::CFGBlock, false>&, unsigned int)
Line
Count
Source
304
8
  void runSemiNCA(DomTreeT &DT, const unsigned MinLevel = 0) {
305
8
    const unsigned NextDFSNum(NumToNode.size());
306
8
    // Initialize IDoms to spanning tree parents.
307
74
    for (unsigned i = 1; i < NextDFSNum; 
++i66
) {
308
66
      const NodePtr V = NumToNode[i];
309
66
      auto &VInfo = NodeToInfo[V];
310
66
      VInfo.IDom = NumToNode[VInfo.Parent];
311
66
    }
312
8
313
8
    // Step #1: Calculate the semidominators of all vertices.
314
8
    SmallVector<InfoRec *, 32> EvalStack;
315
66
    for (unsigned i = NextDFSNum - 1; i >= 2; 
--i58
) {
316
58
      NodePtr W = NumToNode[i];
317
58
      auto &WInfo = NodeToInfo[W];
318
58
319
58
      // Initialize the semi dominator to point to the parent node.
320
58
      WInfo.Semi = WInfo.Parent;
321
74
      for (const auto &N : WInfo.ReverseChildren) {
322
74
        if (NodeToInfo.count(N) == 0)  // Skip unreachable predecessors.
323
0
          continue;
324
74
325
74
        const TreeNodePtr TN = DT.getNode(N);
326
74
        // Skip predecessors whose level is above the subtree we are processing.
327
74
        if (TN && 
TN->getLevel() < MinLevel0
)
328
0
          continue;
329
74
330
74
        unsigned SemiU = NodeToInfo[eval(N, i + 1, EvalStack)].Semi;
331
74
        if (SemiU < WInfo.Semi) 
WInfo.Semi = SemiU9
;
332
74
      }
333
58
    }
334
8
335
8
    // Step #2: Explicitly define the immediate dominator of each vertex.
336
8
    //          IDom[i] = NCA(SDom[i], SpanningTreeParent(i)).
337
8
    // Note that the parents were stored in IDoms and later got invalidated
338
8
    // during path compression in Eval.
339
66
    for (unsigned i = 2; i < NextDFSNum; 
++i58
) {
340
58
      const NodePtr W = NumToNode[i];
341
58
      auto &WInfo = NodeToInfo[W];
342
58
      const unsigned SDomNum = NodeToInfo[NumToNode[WInfo.Semi]].DFSNum;
343
58
      NodePtr WIDomCandidate = WInfo.IDom;
344
70
      while (NodeToInfo[WIDomCandidate].DFSNum > SDomNum)
345
12
        WIDomCandidate = NodeToInfo[WIDomCandidate].IDom;
346
58
347
58
      WInfo.IDom = WIDomCandidate;
348
58
    }
349
8
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, true> >::runSemiNCA(llvm::DominatorTreeBase<clang::CFGBlock, true>&, unsigned int)
Line
Count
Source
304
107
  void runSemiNCA(DomTreeT &DT, const unsigned MinLevel = 0) {
305
107
    const unsigned NextDFSNum(NumToNode.size());
306
107
    // Initialize IDoms to spanning tree parents.
307
763
    for (unsigned i = 1; i < NextDFSNum; 
++i656
) {
308
656
      const NodePtr V = NumToNode[i];
309
656
      auto &VInfo = NodeToInfo[V];
310
656
      VInfo.IDom = NumToNode[VInfo.Parent];
311
656
    }
312
107
313
107
    // Step #1: Calculate the semidominators of all vertices.
314
107
    SmallVector<InfoRec *, 32> EvalStack;
315
656
    for (unsigned i = NextDFSNum - 1; i >= 2; 
--i549
) {
316
549
      NodePtr W = NumToNode[i];
317
549
      auto &WInfo = NodeToInfo[W];
318
549
319
549
      // Initialize the semi dominator to point to the parent node.
320
549
      WInfo.Semi = WInfo.Parent;
321
589
      for (const auto &N : WInfo.ReverseChildren) {
322
589
        if (NodeToInfo.count(N) == 0)  // Skip unreachable predecessors.
323
0
          continue;
324
589
325
589
        const TreeNodePtr TN = DT.getNode(N);
326
589
        // Skip predecessors whose level is above the subtree we are processing.
327
589
        if (TN && 
TN->getLevel() < MinLevel0
)
328
0
          continue;
329
589
330
589
        unsigned SemiU = NodeToInfo[eval(N, i + 1, EvalStack)].Semi;
331
589
        if (SemiU < WInfo.Semi) 
WInfo.Semi = SemiU16
;
332
589
      }
333
549
    }
334
107
335
107
    // Step #2: Explicitly define the immediate dominator of each vertex.
336
107
    //          IDom[i] = NCA(SDom[i], SpanningTreeParent(i)).
337
107
    // Note that the parents were stored in IDoms and later got invalidated
338
107
    // during path compression in Eval.
339
656
    for (unsigned i = 2; i < NextDFSNum; 
++i549
) {
340
549
      const NodePtr W = NumToNode[i];
341
549
      auto &WInfo = NodeToInfo[W];
342
549
      const unsigned SDomNum = NodeToInfo[NumToNode[WInfo.Semi]].DFSNum;
343
549
      NodePtr WIDomCandidate = WInfo.IDom;
344
569
      while (NodeToInfo[WIDomCandidate].DFSNum > SDomNum)
345
20
        WIDomCandidate = NodeToInfo[WIDomCandidate].IDom;
346
549
347
549
      WInfo.IDom = WIDomCandidate;
348
549
    }
349
107
  }
350
351
  // PostDominatorTree always has a virtual root that represents a virtual CFG
352
  // node that serves as a single exit from the function. All the other exits
353
  // (CFG nodes with terminators and nodes in infinite loops are logically
354
  // connected to this virtual CFG exit node).
355
  // This functions maps a nullptr CFG node to the virtual root tree node.
356
4.22M
  void addVirtualRoot() {
357
4.22M
    assert(IsPostDom && "Only postdominators have a virtual root");
358
4.22M
    assert(NumToNode.size() == 1 && "SNCAInfo must be freshly constructed");
359
4.22M
360
4.22M
    auto &BBInfo = NodeToInfo[nullptr];
361
4.22M
    BBInfo.DFSNum = BBInfo.Semi = 1;
362
4.22M
    BBInfo.Label = nullptr;
363
4.22M
364
4.22M
    NumToNode.push_back(nullptr);  // NumToNode[1] = nullptr;
365
4.22M
  }
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::addVirtualRoot()
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::addVirtualRoot()
Line
Count
Source
356
3.01M
  void addVirtualRoot() {
357
3.01M
    assert(IsPostDom && "Only postdominators have a virtual root");
358
3.01M
    assert(NumToNode.size() == 1 && "SNCAInfo must be freshly constructed");
359
3.01M
360
3.01M
    auto &BBInfo = NodeToInfo[nullptr];
361
3.01M
    BBInfo.DFSNum = BBInfo.Semi = 1;
362
3.01M
    BBInfo.Label = nullptr;
363
3.01M
364
3.01M
    NumToNode.push_back(nullptr);  // NumToNode[1] = nullptr;
365
3.01M
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::addVirtualRoot()
Line
Count
Source
356
1.21M
  void addVirtualRoot() {
357
1.21M
    assert(IsPostDom && "Only postdominators have a virtual root");
358
1.21M
    assert(NumToNode.size() == 1 && "SNCAInfo must be freshly constructed");
359
1.21M
360
1.21M
    auto &BBInfo = NodeToInfo[nullptr];
361
1.21M
    BBInfo.DFSNum = BBInfo.Semi = 1;
362
1.21M
    BBInfo.Label = nullptr;
363
1.21M
364
1.21M
    NumToNode.push_back(nullptr);  // NumToNode[1] = nullptr;
365
1.21M
  }
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::addVirtualRoot()
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::addVirtualRoot()
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, true> >::addVirtualRoot()
Line
Count
Source
356
214
  void addVirtualRoot() {
357
214
    assert(IsPostDom && "Only postdominators have a virtual root");
358
214
    assert(NumToNode.size() == 1 && "SNCAInfo must be freshly constructed");
359
214
360
214
    auto &BBInfo = NodeToInfo[nullptr];
361
214
    BBInfo.DFSNum = BBInfo.Semi = 1;
362
214
    BBInfo.Label = nullptr;
363
214
364
214
    NumToNode.push_back(nullptr);  // NumToNode[1] = nullptr;
365
214
  }
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, false> >::addVirtualRoot()
366
367
  // For postdominators, nodes with no forward successors are trivial roots that
368
  // are always selected as tree roots. Roots with forward successors correspond
369
  // to CFG nodes within infinite loops.
370
11.5M
  static bool HasForwardSuccessors(const NodePtr N, BatchUpdatePtr BUI) {
371
11.5M
    assert(N && "N must be a valid node");
372
11.5M
    return !ChildrenGetter<false>::Get(N, BUI).empty();
373
11.5M
  }
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::HasForwardSuccessors(llvm::MachineBasicBlock*, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::BatchUpdateInfo*)
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::HasForwardSuccessors(llvm::MachineBasicBlock*, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::BatchUpdateInfo*)
Line
Count
Source
370
8.52M
  static bool HasForwardSuccessors(const NodePtr N, BatchUpdatePtr BUI) {
371
8.52M
    assert(N && "N must be a valid node");
372
8.52M
    return !ChildrenGetter<false>::Get(N, BUI).empty();
373
8.52M
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::HasForwardSuccessors(llvm::BasicBlock*, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::BatchUpdateInfo*)
Line
Count
Source
370
3.06M
  static bool HasForwardSuccessors(const NodePtr N, BatchUpdatePtr BUI) {
371
3.06M
    assert(N && "N must be a valid node");
372
3.06M
    return !ChildrenGetter<false>::Get(N, BUI).empty();
373
3.06M
  }
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::HasForwardSuccessors(llvm::BasicBlock*, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::BatchUpdateInfo*)
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::HasForwardSuccessors(llvm::VPBlockBase*, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::BatchUpdateInfo*)
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, true> >::HasForwardSuccessors(clang::CFGBlock*, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, true> >::BatchUpdateInfo*)
Line
Count
Source
370
549
  static bool HasForwardSuccessors(const NodePtr N, BatchUpdatePtr BUI) {
371
549
    assert(N && "N must be a valid node");
372
549
    return !ChildrenGetter<false>::Get(N, BUI).empty();
373
549
  }
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, false> >::HasForwardSuccessors(clang::CFGBlock*, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, false> >::BatchUpdateInfo*)
374
375
13.0M
  static NodePtr GetEntryNode(const DomTreeT &DT) {
376
13.0M
    assert(DT.Parent && "Parent not set");
377
13.0M
    return GraphTraits<typename DomTreeT::ParentPtr>::getEntryNode(DT.Parent);
378
13.0M
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::GetEntryNode(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> const&)
Line
Count
Source
375
2.61M
  static NodePtr GetEntryNode(const DomTreeT &DT) {
376
2.61M
    assert(DT.Parent && "Parent not set");
377
2.61M
    return GraphTraits<typename DomTreeT::ParentPtr>::getEntryNode(DT.Parent);
378
2.61M
  }
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::GetEntryNode(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> const&)
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::GetEntryNode(llvm::DominatorTreeBase<llvm::BasicBlock, false> const&)
Line
Count
Source
375
10.3M
  static NodePtr GetEntryNode(const DomTreeT &DT) {
376
10.3M
    assert(DT.Parent && "Parent not set");
377
10.3M
    return GraphTraits<typename DomTreeT::ParentPtr>::getEntryNode(DT.Parent);
378
10.3M
  }
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::GetEntryNode(llvm::DominatorTreeBase<llvm::BasicBlock, true> const&)
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::GetEntryNode(llvm::DominatorTreeBase<llvm::VPBlockBase, false> const&)
Line
Count
Source
375
28
  static NodePtr GetEntryNode(const DomTreeT &DT) {
376
28
    assert(DT.Parent && "Parent not set");
377
28
    return GraphTraits<typename DomTreeT::ParentPtr>::getEntryNode(DT.Parent);
378
28
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, false> >::GetEntryNode(llvm::DominatorTreeBase<clang::CFGBlock, false> const&)
Line
Count
Source
375
8
  static NodePtr GetEntryNode(const DomTreeT &DT) {
376
8
    assert(DT.Parent && "Parent not set");
377
8
    return GraphTraits<typename DomTreeT::ParentPtr>::getEntryNode(DT.Parent);
378
8
  }
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, true> >::GetEntryNode(llvm::DominatorTreeBase<clang::CFGBlock, true> const&)
379
380
  // Finds all roots without relaying on the set of roots already stored in the
381
  // tree.
382
  // We define roots to be some non-redundant set of the CFG nodes
383
15.1M
  static RootsT FindRoots(const DomTreeT &DT, BatchUpdatePtr BUI) {
384
15.1M
    assert(DT.Parent && "Parent pointer is not set");
385
15.1M
    RootsT Roots;
386
15.1M
387
15.1M
    // For dominators, function entry CFG node is always a tree root node.
388
15.1M
    if (!IsPostDom) {
389
13.0M
      Roots.push_back(GetEntryNode(DT));
390
13.0M
      return Roots;
391
13.0M
    }
392
2.11M
393
2.11M
    SemiNCAInfo SNCA(BUI);
394
2.11M
395
2.11M
    // PostDominatorTree always has a virtual root.
396
2.11M
    SNCA.addVirtualRoot();
397
2.11M
    unsigned Num = 1;
398
2.11M
399
2.11M
    LLVM_DEBUG(dbgs() << "\t\tLooking for trivial roots\n");
400
2.11M
401
2.11M
    // Step #1: Find all the trivial roots that are going to will definitely
402
2.11M
    // remain tree roots.
403
2.11M
    unsigned Total = 0;
404
2.11M
    // It may happen that there are some new nodes in the CFG that are result of
405
2.11M
    // the ongoing batch update, but we cannot really pretend that they don't
406
2.11M
    // exist -- we won't see any outgoing or incoming edges to them, so it's
407
2.11M
    // fine to discover them here, as they would end up appearing in the CFG at
408
2.11M
    // some point anyway.
409
11.5M
    for (const NodePtr N : nodes(DT.Parent)) {
410
11.5M
      ++Total;
411
11.5M
      // If it has no *successors*, it is definitely a root.
412
11.5M
      if (!HasForwardSuccessors(N, BUI)) {
413
2.59M
        Roots.push_back(N);
414
2.59M
        // Run DFS not to walk this part of CFG later.
415
2.59M
        Num = SNCA.runDFS(N, Num, AlwaysDescend, 1);
416
2.59M
        LLVM_DEBUG(dbgs() << "Found a new trivial root: " << BlockNamePrinter(N)
417
2.59M
                          << "\n");
418
2.59M
        LLVM_DEBUG(dbgs() << "Last visited node: "
419
2.59M
                          << BlockNamePrinter(SNCA.NumToNode[Num]) << "\n");
420
2.59M
      }
421
11.5M
    }
422
2.11M
423
2.11M
    LLVM_DEBUG(dbgs() << "\t\tLooking for non-trivial roots\n");
424
2.11M
425
2.11M
    // Step #2: Find all non-trivial root candidates. Those are CFG nodes that
426
2.11M
    // are reverse-unreachable were not visited by previous DFS walks (i.e. CFG
427
2.11M
    // nodes in infinite loops).
428
2.11M
    bool HasNonTrivialRoots = false;
429
2.11M
    // Accounting for the virtual exit, see if we had any reverse-unreachable
430
2.11M
    // nodes.
431
2.11M
    if (Total + 1 != Num) {
432
1.80k
      HasNonTrivialRoots = true;
433
1.80k
      // Make another DFS pass over all other nodes to find the
434
1.80k
      // reverse-unreachable blocks, and find the furthest paths we'll be able
435
1.80k
      // to make.
436
1.80k
      // Note that this looks N^2, but it's really 2N worst case, if every node
437
1.80k
      // is unreachable. This is because we are still going to only visit each
438
1.80k
      // unreachable node once, we may just visit it in two directions,
439
1.80k
      // depending on how lucky we get.
440
1.80k
      SmallPtrSet<NodePtr, 4> ConnectToExitBlock;
441
18.2k
      for (const NodePtr I : nodes(DT.Parent)) {
442
18.2k
        if (SNCA.NodeToInfo.count(I) == 0) {
443
1.99k
          LLVM_DEBUG(dbgs()
444
1.99k
                     << "\t\t\tVisiting node " << BlockNamePrinter(I) << "\n");
445
1.99k
          // Find the furthest away we can get by following successors, then
446
1.99k
          // follow them in reverse.  This gives us some reasonable answer about
447
1.99k
          // the post-dom tree inside any infinite loop. In particular, it
448
1.99k
          // guarantees we get to the farthest away point along *some*
449
1.99k
          // path. This also matches the GCC's behavior.
450
1.99k
          // If we really wanted a totally complete picture of dominance inside
451
1.99k
          // this infinite loop, we could do it with SCC-like algorithms to find
452
1.99k
          // the lowest and highest points in the infinite loop.  In theory, it
453
1.99k
          // would be nice to give the canonical backedge for the loop, but it's
454
1.99k
          // expensive and does not always lead to a minimal set of roots.
455
1.99k
          LLVM_DEBUG(dbgs() << "\t\t\tRunning forward DFS\n");
456
1.99k
457
1.99k
          const unsigned NewNum = SNCA.runDFS<true>(I, Num, AlwaysDescend, Num);
458
1.99k
          const NodePtr FurthestAway = SNCA.NumToNode[NewNum];
459
1.99k
          LLVM_DEBUG(dbgs() << "\t\t\tFound a new furthest away node "
460
1.99k
                            << "(non-trivial root): "
461
1.99k
                            << BlockNamePrinter(FurthestAway) << "\n");
462
1.99k
          ConnectToExitBlock.insert(FurthestAway);
463
1.99k
          Roots.push_back(FurthestAway);
464
1.99k
          LLVM_DEBUG(dbgs() << "\t\t\tPrev DFSNum: " << Num << ", new DFSNum: "
465
1.99k
                            << NewNum << "\n\t\t\tRemoving DFS info\n");
466
8.11k
          for (unsigned i = NewNum; i > Num; 
--i6.12k
) {
467
6.12k
            const NodePtr N = SNCA.NumToNode[i];
468
6.12k
            LLVM_DEBUG(dbgs() << "\t\t\t\tRemoving DFS info for "
469
6.12k
                              << BlockNamePrinter(N) << "\n");
470
6.12k
            SNCA.NodeToInfo.erase(N);
471
6.12k
            SNCA.NumToNode.pop_back();
472
6.12k
          }
473
1.99k
          const unsigned PrevNum = Num;
474
1.99k
          LLVM_DEBUG(dbgs() << "\t\t\tRunning reverse DFS\n");
475
1.99k
          Num = SNCA.runDFS(FurthestAway, Num, AlwaysDescend, 1);
476
7.89k
          for (unsigned i = PrevNum + 1; i <= Num; 
++i5.90k
)
477
1.99k
            LLVM_DEBUG(dbgs() << "\t\t\t\tfound node "
478
1.99k
                              << BlockNamePrinter(SNCA.NumToNode[i]) << "\n");
479
1.99k
        }
480
18.2k
      }
481
1.80k
    }
482
2.11M
483
2.11M
    LLVM_DEBUG(dbgs() << "Total: " << Total << ", Num: " << Num << "\n");
484
2.11M
    LLVM_DEBUG(dbgs() << "Discovered CFG nodes:\n");
485
2.11M
    LLVM_DEBUG(for (size_t i = 0; i <= Num; ++i) dbgs()
486
2.11M
               << i << ": " << BlockNamePrinter(SNCA.NumToNode[i]) << "\n");
487
2.11M
488
2.11M
    assert((Total + 1 == Num) && "Everything should have been visited");
489
2.11M
490
2.11M
    // Step #3: If we found some non-trivial roots, make them non-redundant.
491
2.11M
    if (HasNonTrivialRoots) 
RemoveRedundantRoots(DT, BUI, Roots)1.80k
;
492
2.11M
493
2.11M
    LLVM_DEBUG(dbgs() << "Found roots: ");
494
2.11M
    LLVM_DEBUG(for (auto *Root
495
2.11M
                    : Roots) dbgs()
496
2.11M
               << BlockNamePrinter(Root) << " ");
497
2.11M
    LLVM_DEBUG(dbgs() << "\n");
498
2.11M
499
2.11M
    return Roots;
500
2.11M
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::FindRoots(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> const&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::BatchUpdateInfo*)
Line
Count
Source
383
2.61M
  static RootsT FindRoots(const DomTreeT &DT, BatchUpdatePtr BUI) {
384
2.61M
    assert(DT.Parent && "Parent pointer is not set");
385
2.61M
    RootsT Roots;
386
2.61M
387
2.61M
    // For dominators, function entry CFG node is always a tree root node.
388
2.61M
    if (!IsPostDom) {
389
2.61M
      Roots.push_back(GetEntryNode(DT));
390
2.61M
      return Roots;
391
2.61M
    }
392
0
393
0
    SemiNCAInfo SNCA(BUI);
394
0
395
0
    // PostDominatorTree always has a virtual root.
396
0
    SNCA.addVirtualRoot();
397
0
    unsigned Num = 1;
398
0
399
0
    LLVM_DEBUG(dbgs() << "\t\tLooking for trivial roots\n");
400
0
401
0
    // Step #1: Find all the trivial roots that are going to will definitely
402
0
    // remain tree roots.
403
0
    unsigned Total = 0;
404
0
    // It may happen that there are some new nodes in the CFG that are result of
405
0
    // the ongoing batch update, but we cannot really pretend that they don't
406
0
    // exist -- we won't see any outgoing or incoming edges to them, so it's
407
0
    // fine to discover them here, as they would end up appearing in the CFG at
408
0
    // some point anyway.
409
0
    for (const NodePtr N : nodes(DT.Parent)) {
410
0
      ++Total;
411
0
      // If it has no *successors*, it is definitely a root.
412
0
      if (!HasForwardSuccessors(N, BUI)) {
413
0
        Roots.push_back(N);
414
0
        // Run DFS not to walk this part of CFG later.
415
0
        Num = SNCA.runDFS(N, Num, AlwaysDescend, 1);
416
0
        LLVM_DEBUG(dbgs() << "Found a new trivial root: " << BlockNamePrinter(N)
417
0
                          << "\n");
418
0
        LLVM_DEBUG(dbgs() << "Last visited node: "
419
0
                          << BlockNamePrinter(SNCA.NumToNode[Num]) << "\n");
420
0
      }
421
0
    }
422
0
423
0
    LLVM_DEBUG(dbgs() << "\t\tLooking for non-trivial roots\n");
424
0
425
0
    // Step #2: Find all non-trivial root candidates. Those are CFG nodes that
426
0
    // are reverse-unreachable were not visited by previous DFS walks (i.e. CFG
427
0
    // nodes in infinite loops).
428
0
    bool HasNonTrivialRoots = false;
429
0
    // Accounting for the virtual exit, see if we had any reverse-unreachable
430
0
    // nodes.
431
0
    if (Total + 1 != Num) {
432
0
      HasNonTrivialRoots = true;
433
0
      // Make another DFS pass over all other nodes to find the
434
0
      // reverse-unreachable blocks, and find the furthest paths we'll be able
435
0
      // to make.
436
0
      // Note that this looks N^2, but it's really 2N worst case, if every node
437
0
      // is unreachable. This is because we are still going to only visit each
438
0
      // unreachable node once, we may just visit it in two directions,
439
0
      // depending on how lucky we get.
440
0
      SmallPtrSet<NodePtr, 4> ConnectToExitBlock;
441
0
      for (const NodePtr I : nodes(DT.Parent)) {
442
0
        if (SNCA.NodeToInfo.count(I) == 0) {
443
0
          LLVM_DEBUG(dbgs()
444
0
                     << "\t\t\tVisiting node " << BlockNamePrinter(I) << "\n");
445
0
          // Find the furthest away we can get by following successors, then
446
0
          // follow them in reverse.  This gives us some reasonable answer about
447
0
          // the post-dom tree inside any infinite loop. In particular, it
448
0
          // guarantees we get to the farthest away point along *some*
449
0
          // path. This also matches the GCC's behavior.
450
0
          // If we really wanted a totally complete picture of dominance inside
451
0
          // this infinite loop, we could do it with SCC-like algorithms to find
452
0
          // the lowest and highest points in the infinite loop.  In theory, it
453
0
          // would be nice to give the canonical backedge for the loop, but it's
454
0
          // expensive and does not always lead to a minimal set of roots.
455
0
          LLVM_DEBUG(dbgs() << "\t\t\tRunning forward DFS\n");
456
0
457
0
          const unsigned NewNum = SNCA.runDFS<true>(I, Num, AlwaysDescend, Num);
458
0
          const NodePtr FurthestAway = SNCA.NumToNode[NewNum];
459
0
          LLVM_DEBUG(dbgs() << "\t\t\tFound a new furthest away node "
460
0
                            << "(non-trivial root): "
461
0
                            << BlockNamePrinter(FurthestAway) << "\n");
462
0
          ConnectToExitBlock.insert(FurthestAway);
463
0
          Roots.push_back(FurthestAway);
464
0
          LLVM_DEBUG(dbgs() << "\t\t\tPrev DFSNum: " << Num << ", new DFSNum: "
465
0
                            << NewNum << "\n\t\t\tRemoving DFS info\n");
466
0
          for (unsigned i = NewNum; i > Num; --i) {
467
0
            const NodePtr N = SNCA.NumToNode[i];
468
0
            LLVM_DEBUG(dbgs() << "\t\t\t\tRemoving DFS info for "
469
0
                              << BlockNamePrinter(N) << "\n");
470
0
            SNCA.NodeToInfo.erase(N);
471
0
            SNCA.NumToNode.pop_back();
472
0
          }
473
0
          const unsigned PrevNum = Num;
474
0
          LLVM_DEBUG(dbgs() << "\t\t\tRunning reverse DFS\n");
475
0
          Num = SNCA.runDFS(FurthestAway, Num, AlwaysDescend, 1);
476
0
          for (unsigned i = PrevNum + 1; i <= Num; ++i)
477
0
            LLVM_DEBUG(dbgs() << "\t\t\t\tfound node "
478
0
                              << BlockNamePrinter(SNCA.NumToNode[i]) << "\n");
479
0
        }
480
0
      }
481
0
    }
482
0
483
0
    LLVM_DEBUG(dbgs() << "Total: " << Total << ", Num: " << Num << "\n");
484
0
    LLVM_DEBUG(dbgs() << "Discovered CFG nodes:\n");
485
0
    LLVM_DEBUG(for (size_t i = 0; i <= Num; ++i) dbgs()
486
0
               << i << ": " << BlockNamePrinter(SNCA.NumToNode[i]) << "\n");
487
0
488
0
    assert((Total + 1 == Num) && "Everything should have been visited");
489
0
490
0
    // Step #3: If we found some non-trivial roots, make them non-redundant.
491
0
    if (HasNonTrivialRoots) RemoveRedundantRoots(DT, BUI, Roots);
492
0
493
0
    LLVM_DEBUG(dbgs() << "Found roots: ");
494
0
    LLVM_DEBUG(for (auto *Root
495
0
                    : Roots) dbgs()
496
0
               << BlockNamePrinter(Root) << " ");
497
0
    LLVM_DEBUG(dbgs() << "\n");
498
0
499
0
    return Roots;
500
0
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::FindRoots(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> const&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::BatchUpdateInfo*)
Line
Count
Source
383
1.50M
  static RootsT FindRoots(const DomTreeT &DT, BatchUpdatePtr BUI) {
384
1.50M
    assert(DT.Parent && "Parent pointer is not set");
385
1.50M
    RootsT Roots;
386
1.50M
387
1.50M
    // For dominators, function entry CFG node is always a tree root node.
388
1.50M
    if (!IsPostDom) {
389
0
      Roots.push_back(GetEntryNode(DT));
390
0
      return Roots;
391
0
    }
392
1.50M
393
1.50M
    SemiNCAInfo SNCA(BUI);
394
1.50M
395
1.50M
    // PostDominatorTree always has a virtual root.
396
1.50M
    SNCA.addVirtualRoot();
397
1.50M
    unsigned Num = 1;
398
1.50M
399
1.50M
    LLVM_DEBUG(dbgs() << "\t\tLooking for trivial roots\n");
400
1.50M
401
1.50M
    // Step #1: Find all the trivial roots that are going to will definitely
402
1.50M
    // remain tree roots.
403
1.50M
    unsigned Total = 0;
404
1.50M
    // It may happen that there are some new nodes in the CFG that are result of
405
1.50M
    // the ongoing batch update, but we cannot really pretend that they don't
406
1.50M
    // exist -- we won't see any outgoing or incoming edges to them, so it's
407
1.50M
    // fine to discover them here, as they would end up appearing in the CFG at
408
1.50M
    // some point anyway.
409
8.52M
    for (const NodePtr N : nodes(DT.Parent)) {
410
8.52M
      ++Total;
411
8.52M
      // If it has no *successors*, it is definitely a root.
412
8.52M
      if (!HasForwardSuccessors(N, BUI)) {
413
1.92M
        Roots.push_back(N);
414
1.92M
        // Run DFS not to walk this part of CFG later.
415
1.92M
        Num = SNCA.runDFS(N, Num, AlwaysDescend, 1);
416
1.92M
        LLVM_DEBUG(dbgs() << "Found a new trivial root: " << BlockNamePrinter(N)
417
1.92M
                          << "\n");
418
1.92M
        LLVM_DEBUG(dbgs() << "Last visited node: "
419
1.92M
                          << BlockNamePrinter(SNCA.NumToNode[Num]) << "\n");
420
1.92M
      }
421
8.52M
    }
422
1.50M
423
1.50M
    LLVM_DEBUG(dbgs() << "\t\tLooking for non-trivial roots\n");
424
1.50M
425
1.50M
    // Step #2: Find all non-trivial root candidates. Those are CFG nodes that
426
1.50M
    // are reverse-unreachable were not visited by previous DFS walks (i.e. CFG
427
1.50M
    // nodes in infinite loops).
428
1.50M
    bool HasNonTrivialRoots = false;
429
1.50M
    // Accounting for the virtual exit, see if we had any reverse-unreachable
430
1.50M
    // nodes.
431
1.50M
    if (Total + 1 != Num) {
432
1.29k
      HasNonTrivialRoots = true;
433
1.29k
      // Make another DFS pass over all other nodes to find the
434
1.29k
      // reverse-unreachable blocks, and find the furthest paths we'll be able
435
1.29k
      // to make.
436
1.29k
      // Note that this looks N^2, but it's really 2N worst case, if every node
437
1.29k
      // is unreachable. This is because we are still going to only visit each
438
1.29k
      // unreachable node once, we may just visit it in two directions,
439
1.29k
      // depending on how lucky we get.
440
1.29k
      SmallPtrSet<NodePtr, 4> ConnectToExitBlock;
441
9.47k
      for (const NodePtr I : nodes(DT.Parent)) {
442
9.47k
        if (SNCA.NodeToInfo.count(I) == 0) {
443
1.38k
          LLVM_DEBUG(dbgs()
444
1.38k
                     << "\t\t\tVisiting node " << BlockNamePrinter(I) << "\n");
445
1.38k
          // Find the furthest away we can get by following successors, then
446
1.38k
          // follow them in reverse.  This gives us some reasonable answer about
447
1.38k
          // the post-dom tree inside any infinite loop. In particular, it
448
1.38k
          // guarantees we get to the farthest away point along *some*
449
1.38k
          // path. This also matches the GCC's behavior.
450
1.38k
          // If we really wanted a totally complete picture of dominance inside
451
1.38k
          // this infinite loop, we could do it with SCC-like algorithms to find
452
1.38k
          // the lowest and highest points in the infinite loop.  In theory, it
453
1.38k
          // would be nice to give the canonical backedge for the loop, but it's
454
1.38k
          // expensive and does not always lead to a minimal set of roots.
455
1.38k
          LLVM_DEBUG(dbgs() << "\t\t\tRunning forward DFS\n");
456
1.38k
457
1.38k
          const unsigned NewNum = SNCA.runDFS<true>(I, Num, AlwaysDescend, Num);
458
1.38k
          const NodePtr FurthestAway = SNCA.NumToNode[NewNum];
459
1.38k
          LLVM_DEBUG(dbgs() << "\t\t\tFound a new furthest away node "
460
1.38k
                            << "(non-trivial root): "
461
1.38k
                            << BlockNamePrinter(FurthestAway) << "\n");
462
1.38k
          ConnectToExitBlock.insert(FurthestAway);
463
1.38k
          Roots.push_back(FurthestAway);
464
1.38k
          LLVM_DEBUG(dbgs() << "\t\t\tPrev DFSNum: " << Num << ", new DFSNum: "
465
1.38k
                            << NewNum << "\n\t\t\tRemoving DFS info\n");
466
5.85k
          for (unsigned i = NewNum; i > Num; 
--i4.46k
) {
467
4.46k
            const NodePtr N = SNCA.NumToNode[i];
468
4.46k
            LLVM_DEBUG(dbgs() << "\t\t\t\tRemoving DFS info for "
469
4.46k
                              << BlockNamePrinter(N) << "\n");
470
4.46k
            SNCA.NodeToInfo.erase(N);
471
4.46k
            SNCA.NumToNode.pop_back();
472
4.46k
          }
473
1.38k
          const unsigned PrevNum = Num;
474
1.38k
          LLVM_DEBUG(dbgs() << "\t\t\tRunning reverse DFS\n");
475
1.38k
          Num = SNCA.runDFS(FurthestAway, Num, AlwaysDescend, 1);
476
5.69k
          for (unsigned i = PrevNum + 1; i <= Num; 
++i4.30k
)
477
1.38k
            LLVM_DEBUG(dbgs() << "\t\t\t\tfound node "
478
1.38k
                              << BlockNamePrinter(SNCA.NumToNode[i]) << "\n");
479
1.38k
        }
480
9.47k
      }
481
1.29k
    }
482
1.50M
483
1.50M
    LLVM_DEBUG(dbgs() << "Total: " << Total << ", Num: " << Num << "\n");
484
1.50M
    LLVM_DEBUG(dbgs() << "Discovered CFG nodes:\n");
485
1.50M
    LLVM_DEBUG(for (size_t i = 0; i <= Num; ++i) dbgs()
486
1.50M
               << i << ": " << BlockNamePrinter(SNCA.NumToNode[i]) << "\n");
487
1.50M
488
1.50M
    assert((Total + 1 == Num) && "Everything should have been visited");
489
1.50M
490
1.50M
    // Step #3: If we found some non-trivial roots, make them non-redundant.
491
1.50M
    if (HasNonTrivialRoots) 
RemoveRedundantRoots(DT, BUI, Roots)1.29k
;
492
1.50M
493
1.50M
    LLVM_DEBUG(dbgs() << "Found roots: ");
494
1.50M
    LLVM_DEBUG(for (auto *Root
495
1.50M
                    : Roots) dbgs()
496
1.50M
               << BlockNamePrinter(Root) << " ");
497
1.50M
    LLVM_DEBUG(dbgs() << "\n");
498
1.50M
499
1.50M
    return Roots;
500
1.50M
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::FindRoots(llvm::DominatorTreeBase<llvm::BasicBlock, false> const&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::BatchUpdateInfo*)
Line
Count
Source
383
10.3M
  static RootsT FindRoots(const DomTreeT &DT, BatchUpdatePtr BUI) {
384
10.3M
    assert(DT.Parent && "Parent pointer is not set");
385
10.3M
    RootsT Roots;
386
10.3M
387
10.3M
    // For dominators, function entry CFG node is always a tree root node.
388
10.3M
    if (!IsPostDom) {
389
10.3M
      Roots.push_back(GetEntryNode(DT));
390
10.3M
      return Roots;
391
10.3M
    }
392
0
393
0
    SemiNCAInfo SNCA(BUI);
394
0
395
0
    // PostDominatorTree always has a virtual root.
396
0
    SNCA.addVirtualRoot();
397
0
    unsigned Num = 1;
398
0
399
0
    LLVM_DEBUG(dbgs() << "\t\tLooking for trivial roots\n");
400
0
401
0
    // Step #1: Find all the trivial roots that are going to will definitely
402
0
    // remain tree roots.
403
0
    unsigned Total = 0;
404
0
    // It may happen that there are some new nodes in the CFG that are result of
405
0
    // the ongoing batch update, but we cannot really pretend that they don't
406
0
    // exist -- we won't see any outgoing or incoming edges to them, so it's
407
0
    // fine to discover them here, as they would end up appearing in the CFG at
408
0
    // some point anyway.
409
0
    for (const NodePtr N : nodes(DT.Parent)) {
410
0
      ++Total;
411
0
      // If it has no *successors*, it is definitely a root.
412
0
      if (!HasForwardSuccessors(N, BUI)) {
413
0
        Roots.push_back(N);
414
0
        // Run DFS not to walk this part of CFG later.
415
0
        Num = SNCA.runDFS(N, Num, AlwaysDescend, 1);
416
0
        LLVM_DEBUG(dbgs() << "Found a new trivial root: " << BlockNamePrinter(N)
417
0
                          << "\n");
418
0
        LLVM_DEBUG(dbgs() << "Last visited node: "
419
0
                          << BlockNamePrinter(SNCA.NumToNode[Num]) << "\n");
420
0
      }
421
0
    }
422
0
423
0
    LLVM_DEBUG(dbgs() << "\t\tLooking for non-trivial roots\n");
424
0
425
0
    // Step #2: Find all non-trivial root candidates. Those are CFG nodes that
426
0
    // are reverse-unreachable were not visited by previous DFS walks (i.e. CFG
427
0
    // nodes in infinite loops).
428
0
    bool HasNonTrivialRoots = false;
429
0
    // Accounting for the virtual exit, see if we had any reverse-unreachable
430
0
    // nodes.
431
0
    if (Total + 1 != Num) {
432
0
      HasNonTrivialRoots = true;
433
0
      // Make another DFS pass over all other nodes to find the
434
0
      // reverse-unreachable blocks, and find the furthest paths we'll be able
435
0
      // to make.
436
0
      // Note that this looks N^2, but it's really 2N worst case, if every node
437
0
      // is unreachable. This is because we are still going to only visit each
438
0
      // unreachable node once, we may just visit it in two directions,
439
0
      // depending on how lucky we get.
440
0
      SmallPtrSet<NodePtr, 4> ConnectToExitBlock;
441
0
      for (const NodePtr I : nodes(DT.Parent)) {
442
0
        if (SNCA.NodeToInfo.count(I) == 0) {
443
0
          LLVM_DEBUG(dbgs()
444
0
                     << "\t\t\tVisiting node " << BlockNamePrinter(I) << "\n");
445
0
          // Find the furthest away we can get by following successors, then
446
0
          // follow them in reverse.  This gives us some reasonable answer about
447
0
          // the post-dom tree inside any infinite loop. In particular, it
448
0
          // guarantees we get to the farthest away point along *some*
449
0
          // path. This also matches the GCC's behavior.
450
0
          // If we really wanted a totally complete picture of dominance inside
451
0
          // this infinite loop, we could do it with SCC-like algorithms to find
452
0
          // the lowest and highest points in the infinite loop.  In theory, it
453
0
          // would be nice to give the canonical backedge for the loop, but it's
454
0
          // expensive and does not always lead to a minimal set of roots.
455
0
          LLVM_DEBUG(dbgs() << "\t\t\tRunning forward DFS\n");
456
0
457
0
          const unsigned NewNum = SNCA.runDFS<true>(I, Num, AlwaysDescend, Num);
458
0
          const NodePtr FurthestAway = SNCA.NumToNode[NewNum];
459
0
          LLVM_DEBUG(dbgs() << "\t\t\tFound a new furthest away node "
460
0
                            << "(non-trivial root): "
461
0
                            << BlockNamePrinter(FurthestAway) << "\n");
462
0
          ConnectToExitBlock.insert(FurthestAway);
463
0
          Roots.push_back(FurthestAway);
464
0
          LLVM_DEBUG(dbgs() << "\t\t\tPrev DFSNum: " << Num << ", new DFSNum: "
465
0
                            << NewNum << "\n\t\t\tRemoving DFS info\n");
466
0
          for (unsigned i = NewNum; i > Num; --i) {
467
0
            const NodePtr N = SNCA.NumToNode[i];
468
0
            LLVM_DEBUG(dbgs() << "\t\t\t\tRemoving DFS info for "
469
0
                              << BlockNamePrinter(N) << "\n");
470
0
            SNCA.NodeToInfo.erase(N);
471
0
            SNCA.NumToNode.pop_back();
472
0
          }
473
0
          const unsigned PrevNum = Num;
474
0
          LLVM_DEBUG(dbgs() << "\t\t\tRunning reverse DFS\n");
475
0
          Num = SNCA.runDFS(FurthestAway, Num, AlwaysDescend, 1);
476
0
          for (unsigned i = PrevNum + 1; i <= Num; ++i)
477
0
            LLVM_DEBUG(dbgs() << "\t\t\t\tfound node "
478
0
                              << BlockNamePrinter(SNCA.NumToNode[i]) << "\n");
479
0
        }
480
0
      }
481
0
    }
482
0
483
0
    LLVM_DEBUG(dbgs() << "Total: " << Total << ", Num: " << Num << "\n");
484
0
    LLVM_DEBUG(dbgs() << "Discovered CFG nodes:\n");
485
0
    LLVM_DEBUG(for (size_t i = 0; i <= Num; ++i) dbgs()
486
0
               << i << ": " << BlockNamePrinter(SNCA.NumToNode[i]) << "\n");
487
0
488
0
    assert((Total + 1 == Num) && "Everything should have been visited");
489
0
490
0
    // Step #3: If we found some non-trivial roots, make them non-redundant.
491
0
    if (HasNonTrivialRoots) RemoveRedundantRoots(DT, BUI, Roots);
492
0
493
0
    LLVM_DEBUG(dbgs() << "Found roots: ");
494
0
    LLVM_DEBUG(for (auto *Root
495
0
                    : Roots) dbgs()
496
0
               << BlockNamePrinter(Root) << " ");
497
0
    LLVM_DEBUG(dbgs() << "\n");
498
0
499
0
    return Roots;
500
0
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::FindRoots(llvm::DominatorTreeBase<llvm::BasicBlock, true> const&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::BatchUpdateInfo*)
Line
Count
Source
383
605k
  static RootsT FindRoots(const DomTreeT &DT, BatchUpdatePtr BUI) {
384
605k
    assert(DT.Parent && "Parent pointer is not set");
385
605k
    RootsT Roots;
386
605k
387
605k
    // For dominators, function entry CFG node is always a tree root node.
388
605k
    if (!IsPostDom) {
389
0
      Roots.push_back(GetEntryNode(DT));
390
0
      return Roots;
391
0
    }
392
605k
393
605k
    SemiNCAInfo SNCA(BUI);
394
605k
395
605k
    // PostDominatorTree always has a virtual root.
396
605k
    SNCA.addVirtualRoot();
397
605k
    unsigned Num = 1;
398
605k
399
605k
    LLVM_DEBUG(dbgs() << "\t\tLooking for trivial roots\n");
400
605k
401
605k
    // Step #1: Find all the trivial roots that are going to will definitely
402
605k
    // remain tree roots.
403
605k
    unsigned Total = 0;
404
605k
    // It may happen that there are some new nodes in the CFG that are result of
405
605k
    // the ongoing batch update, but we cannot really pretend that they don't
406
605k
    // exist -- we won't see any outgoing or incoming edges to them, so it's
407
605k
    // fine to discover them here, as they would end up appearing in the CFG at
408
605k
    // some point anyway.
409
3.06M
    for (const NodePtr N : nodes(DT.Parent)) {
410
3.06M
      ++Total;
411
3.06M
      // If it has no *successors*, it is definitely a root.
412
3.06M
      if (!HasForwardSuccessors(N, BUI)) {
413
663k
        Roots.push_back(N);
414
663k
        // Run DFS not to walk this part of CFG later.
415
663k
        Num = SNCA.runDFS(N, Num, AlwaysDescend, 1);
416
663k
        LLVM_DEBUG(dbgs() << "Found a new trivial root: " << BlockNamePrinter(N)
417
663k
                          << "\n");
418
663k
        LLVM_DEBUG(dbgs() << "Last visited node: "
419
663k
                          << BlockNamePrinter(SNCA.NumToNode[Num]) << "\n");
420
663k
      }
421
3.06M
    }
422
605k
423
605k
    LLVM_DEBUG(dbgs() << "\t\tLooking for non-trivial roots\n");
424
605k
425
605k
    // Step #2: Find all non-trivial root candidates. Those are CFG nodes that
426
605k
    // are reverse-unreachable were not visited by previous DFS walks (i.e. CFG
427
605k
    // nodes in infinite loops).
428
605k
    bool HasNonTrivialRoots = false;
429
605k
    // Accounting for the virtual exit, see if we had any reverse-unreachable
430
605k
    // nodes.
431
605k
    if (Total + 1 != Num) {
432
509
      HasNonTrivialRoots = true;
433
509
      // Make another DFS pass over all other nodes to find the
434
509
      // reverse-unreachable blocks, and find the furthest paths we'll be able
435
509
      // to make.
436
509
      // Note that this looks N^2, but it's really 2N worst case, if every node
437
509
      // is unreachable. This is because we are still going to only visit each
438
509
      // unreachable node once, we may just visit it in two directions,
439
509
      // depending on how lucky we get.
440
509
      SmallPtrSet<NodePtr, 4> ConnectToExitBlock;
441
8.76k
      for (const NodePtr I : nodes(DT.Parent)) {
442
8.76k
        if (SNCA.NodeToInfo.count(I) == 0) {
443
606
          LLVM_DEBUG(dbgs()
444
606
                     << "\t\t\tVisiting node " << BlockNamePrinter(I) << "\n");
445
606
          // Find the furthest away we can get by following successors, then
446
606
          // follow them in reverse.  This gives us some reasonable answer about
447
606
          // the post-dom tree inside any infinite loop. In particular, it
448
606
          // guarantees we get to the farthest away point along *some*
449
606
          // path. This also matches the GCC's behavior.
450
606
          // If we really wanted a totally complete picture of dominance inside
451
606
          // this infinite loop, we could do it with SCC-like algorithms to find
452
606
          // the lowest and highest points in the infinite loop.  In theory, it
453
606
          // would be nice to give the canonical backedge for the loop, but it's
454
606
          // expensive and does not always lead to a minimal set of roots.
455
606
          LLVM_DEBUG(dbgs() << "\t\t\tRunning forward DFS\n");
456
606
457
606
          const unsigned NewNum = SNCA.runDFS<true>(I, Num, AlwaysDescend, Num);
458
606
          const NodePtr FurthestAway = SNCA.NumToNode[NewNum];
459
606
          LLVM_DEBUG(dbgs() << "\t\t\tFound a new furthest away node "
460
606
                            << "(non-trivial root): "
461
606
                            << BlockNamePrinter(FurthestAway) << "\n");
462
606
          ConnectToExitBlock.insert(FurthestAway);
463
606
          Roots.push_back(FurthestAway);
464
606
          LLVM_DEBUG(dbgs() << "\t\t\tPrev DFSNum: " << Num << ", new DFSNum: "
465
606
                            << NewNum << "\n\t\t\tRemoving DFS info\n");
466
2.26k
          for (unsigned i = NewNum; i > Num; 
--i1.65k
) {
467
1.65k
            const NodePtr N = SNCA.NumToNode[i];
468
1.65k
            LLVM_DEBUG(dbgs() << "\t\t\t\tRemoving DFS info for "
469
1.65k
                              << BlockNamePrinter(N) << "\n");
470
1.65k
            SNCA.NodeToInfo.erase(N);
471
1.65k
            SNCA.NumToNode.pop_back();
472
1.65k
          }
473
606
          const unsigned PrevNum = Num;
474
606
          LLVM_DEBUG(dbgs() << "\t\t\tRunning reverse DFS\n");
475
606
          Num = SNCA.runDFS(FurthestAway, Num, AlwaysDescend, 1);
476
2.20k
          for (unsigned i = PrevNum + 1; i <= Num; 
++i1.59k
)
477
606
            LLVM_DEBUG(dbgs() << "\t\t\t\tfound node "
478
606
                              << BlockNamePrinter(SNCA.NumToNode[i]) << "\n");
479
606
        }
480
8.76k
      }
481
509
    }
482
605k
483
605k
    LLVM_DEBUG(dbgs() << "Total: " << Total << ", Num: " << Num << "\n");
484
605k
    LLVM_DEBUG(dbgs() << "Discovered CFG nodes:\n");
485
605k
    LLVM_DEBUG(for (size_t i = 0; i <= Num; ++i) dbgs()
486
605k
               << i << ": " << BlockNamePrinter(SNCA.NumToNode[i]) << "\n");
487
605k
488
605k
    assert((Total + 1 == Num) && "Everything should have been visited");
489
605k
490
605k
    // Step #3: If we found some non-trivial roots, make them non-redundant.
491
605k
    if (HasNonTrivialRoots) 
RemoveRedundantRoots(DT, BUI, Roots)509
;
492
605k
493
605k
    LLVM_DEBUG(dbgs() << "Found roots: ");
494
605k
    LLVM_DEBUG(for (auto *Root
495
605k
                    : Roots) dbgs()
496
605k
               << BlockNamePrinter(Root) << " ");
497
605k
    LLVM_DEBUG(dbgs() << "\n");
498
605k
499
605k
    return Roots;
500
605k
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::FindRoots(llvm::DominatorTreeBase<llvm::VPBlockBase, false> const&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::BatchUpdateInfo*)
Line
Count
Source
383
28
  static RootsT FindRoots(const DomTreeT &DT, BatchUpdatePtr BUI) {
384
28
    assert(DT.Parent && "Parent pointer is not set");
385
28
    RootsT Roots;
386
28
387
28
    // For dominators, function entry CFG node is always a tree root node.
388
28
    if (!IsPostDom) {
389
28
      Roots.push_back(GetEntryNode(DT));
390
28
      return Roots;
391
28
    }
392
0
393
0
    SemiNCAInfo SNCA(BUI);
394
0
395
0
    // PostDominatorTree always has a virtual root.
396
0
    SNCA.addVirtualRoot();
397
0
    unsigned Num = 1;
398
0
399
0
    LLVM_DEBUG(dbgs() << "\t\tLooking for trivial roots\n");
400
0
401
0
    // Step #1: Find all the trivial roots that are going to will definitely
402
0
    // remain tree roots.
403
0
    unsigned Total = 0;
404
0
    // It may happen that there are some new nodes in the CFG that are result of
405
0
    // the ongoing batch update, but we cannot really pretend that they don't
406
0
    // exist -- we won't see any outgoing or incoming edges to them, so it's
407
0
    // fine to discover them here, as they would end up appearing in the CFG at
408
0
    // some point anyway.
409
0
    for (const NodePtr N : nodes(DT.Parent)) {
410
0
      ++Total;
411
0
      // If it has no *successors*, it is definitely a root.
412
0
      if (!HasForwardSuccessors(N, BUI)) {
413
0
        Roots.push_back(N);
414
0
        // Run DFS not to walk this part of CFG later.
415
0
        Num = SNCA.runDFS(N, Num, AlwaysDescend, 1);
416
0
        LLVM_DEBUG(dbgs() << "Found a new trivial root: " << BlockNamePrinter(N)
417
0
                          << "\n");
418
0
        LLVM_DEBUG(dbgs() << "Last visited node: "
419
0
                          << BlockNamePrinter(SNCA.NumToNode[Num]) << "\n");
420
0
      }
421
0
    }
422
0
423
0
    LLVM_DEBUG(dbgs() << "\t\tLooking for non-trivial roots\n");
424
0
425
0
    // Step #2: Find all non-trivial root candidates. Those are CFG nodes that
426
0
    // are reverse-unreachable were not visited by previous DFS walks (i.e. CFG
427
0
    // nodes in infinite loops).
428
0
    bool HasNonTrivialRoots = false;
429
0
    // Accounting for the virtual exit, see if we had any reverse-unreachable
430
0
    // nodes.
431
0
    if (Total + 1 != Num) {
432
0
      HasNonTrivialRoots = true;
433
0
      // Make another DFS pass over all other nodes to find the
434
0
      // reverse-unreachable blocks, and find the furthest paths we'll be able
435
0
      // to make.
436
0
      // Note that this looks N^2, but it's really 2N worst case, if every node
437
0
      // is unreachable. This is because we are still going to only visit each
438
0
      // unreachable node once, we may just visit it in two directions,
439
0
      // depending on how lucky we get.
440
0
      SmallPtrSet<NodePtr, 4> ConnectToExitBlock;
441
0
      for (const NodePtr I : nodes(DT.Parent)) {
442
0
        if (SNCA.NodeToInfo.count(I) == 0) {
443
0
          LLVM_DEBUG(dbgs()
444
0
                     << "\t\t\tVisiting node " << BlockNamePrinter(I) << "\n");
445
0
          // Find the furthest away we can get by following successors, then
446
0
          // follow them in reverse.  This gives us some reasonable answer about
447
0
          // the post-dom tree inside any infinite loop. In particular, it
448
0
          // guarantees we get to the farthest away point along *some*
449
0
          // path. This also matches the GCC's behavior.
450
0
          // If we really wanted a totally complete picture of dominance inside
451
0
          // this infinite loop, we could do it with SCC-like algorithms to find
452
0
          // the lowest and highest points in the infinite loop.  In theory, it
453
0
          // would be nice to give the canonical backedge for the loop, but it's
454
0
          // expensive and does not always lead to a minimal set of roots.
455
0
          LLVM_DEBUG(dbgs() << "\t\t\tRunning forward DFS\n");
456
0
457
0
          const unsigned NewNum = SNCA.runDFS<true>(I, Num, AlwaysDescend, Num);
458
0
          const NodePtr FurthestAway = SNCA.NumToNode[NewNum];
459
0
          LLVM_DEBUG(dbgs() << "\t\t\tFound a new furthest away node "
460
0
                            << "(non-trivial root): "
461
0
                            << BlockNamePrinter(FurthestAway) << "\n");
462
0
          ConnectToExitBlock.insert(FurthestAway);
463
0
          Roots.push_back(FurthestAway);
464
0
          LLVM_DEBUG(dbgs() << "\t\t\tPrev DFSNum: " << Num << ", new DFSNum: "
465
0
                            << NewNum << "\n\t\t\tRemoving DFS info\n");
466
0
          for (unsigned i = NewNum; i > Num; --i) {
467
0
            const NodePtr N = SNCA.NumToNode[i];
468
0
            LLVM_DEBUG(dbgs() << "\t\t\t\tRemoving DFS info for "
469
0
                              << BlockNamePrinter(N) << "\n");
470
0
            SNCA.NodeToInfo.erase(N);
471
0
            SNCA.NumToNode.pop_back();
472
0
          }
473
0
          const unsigned PrevNum = Num;
474
0
          LLVM_DEBUG(dbgs() << "\t\t\tRunning reverse DFS\n");
475
0
          Num = SNCA.runDFS(FurthestAway, Num, AlwaysDescend, 1);
476
0
          for (unsigned i = PrevNum + 1; i <= Num; ++i)
477
0
            LLVM_DEBUG(dbgs() << "\t\t\t\tfound node "
478
0
                              << BlockNamePrinter(SNCA.NumToNode[i]) << "\n");
479
0
        }
480
0
      }
481
0
    }
482
0
483
0
    LLVM_DEBUG(dbgs() << "Total: " << Total << ", Num: " << Num << "\n");
484
0
    LLVM_DEBUG(dbgs() << "Discovered CFG nodes:\n");
485
0
    LLVM_DEBUG(for (size_t i = 0; i <= Num; ++i) dbgs()
486
0
               << i << ": " << BlockNamePrinter(SNCA.NumToNode[i]) << "\n");
487
0
488
0
    assert((Total + 1 == Num) && "Everything should have been visited");
489
0
490
0
    // Step #3: If we found some non-trivial roots, make them non-redundant.
491
0
    if (HasNonTrivialRoots) RemoveRedundantRoots(DT, BUI, Roots);
492
0
493
0
    LLVM_DEBUG(dbgs() << "Found roots: ");
494
0
    LLVM_DEBUG(for (auto *Root
495
0
                    : Roots) dbgs()
496
0
               << BlockNamePrinter(Root) << " ");
497
0
    LLVM_DEBUG(dbgs() << "\n");
498
0
499
0
    return Roots;
500
0
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, false> >::FindRoots(llvm::DominatorTreeBase<clang::CFGBlock, false> const&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, false> >::BatchUpdateInfo*)
Line
Count
Source
383
8
  static RootsT FindRoots(const DomTreeT &DT, BatchUpdatePtr BUI) {
384
8
    assert(DT.Parent && "Parent pointer is not set");
385
8
    RootsT Roots;
386
8
387
8
    // For dominators, function entry CFG node is always a tree root node.
388
8
    if (!IsPostDom) {
389
8
      Roots.push_back(GetEntryNode(DT));
390
8
      return Roots;
391
8
    }
392
0
393
0
    SemiNCAInfo SNCA(BUI);
394
0
395
0
    // PostDominatorTree always has a virtual root.
396
0
    SNCA.addVirtualRoot();
397
0
    unsigned Num = 1;
398
0
399
0
    LLVM_DEBUG(dbgs() << "\t\tLooking for trivial roots\n");
400
0
401
0
    // Step #1: Find all the trivial roots that are going to will definitely
402
0
    // remain tree roots.
403
0
    unsigned Total = 0;
404
0
    // It may happen that there are some new nodes in the CFG that are result of
405
0
    // the ongoing batch update, but we cannot really pretend that they don't
406
0
    // exist -- we won't see any outgoing or incoming edges to them, so it's
407
0
    // fine to discover them here, as they would end up appearing in the CFG at
408
0
    // some point anyway.
409
0
    for (const NodePtr N : nodes(DT.Parent)) {
410
0
      ++Total;
411
0
      // If it has no *successors*, it is definitely a root.
412
0
      if (!HasForwardSuccessors(N, BUI)) {
413
0
        Roots.push_back(N);
414
0
        // Run DFS not to walk this part of CFG later.
415
0
        Num = SNCA.runDFS(N, Num, AlwaysDescend, 1);
416
0
        LLVM_DEBUG(dbgs() << "Found a new trivial root: " << BlockNamePrinter(N)
417
0
                          << "\n");
418
0
        LLVM_DEBUG(dbgs() << "Last visited node: "
419
0
                          << BlockNamePrinter(SNCA.NumToNode[Num]) << "\n");
420
0
      }
421
0
    }
422
0
423
0
    LLVM_DEBUG(dbgs() << "\t\tLooking for non-trivial roots\n");
424
0
425
0
    // Step #2: Find all non-trivial root candidates. Those are CFG nodes that
426
0
    // are reverse-unreachable were not visited by previous DFS walks (i.e. CFG
427
0
    // nodes in infinite loops).
428
0
    bool HasNonTrivialRoots = false;
429
0
    // Accounting for the virtual exit, see if we had any reverse-unreachable
430
0
    // nodes.
431
0
    if (Total + 1 != Num) {
432
0
      HasNonTrivialRoots = true;
433
0
      // Make another DFS pass over all other nodes to find the
434
0
      // reverse-unreachable blocks, and find the furthest paths we'll be able
435
0
      // to make.
436
0
      // Note that this looks N^2, but it's really 2N worst case, if every node
437
0
      // is unreachable. This is because we are still going to only visit each
438
0
      // unreachable node once, we may just visit it in two directions,
439
0
      // depending on how lucky we get.
440
0
      SmallPtrSet<NodePtr, 4> ConnectToExitBlock;
441
0
      for (const NodePtr I : nodes(DT.Parent)) {
442
0
        if (SNCA.NodeToInfo.count(I) == 0) {
443
0
          LLVM_DEBUG(dbgs()
444
0
                     << "\t\t\tVisiting node " << BlockNamePrinter(I) << "\n");
445
0
          // Find the furthest away we can get by following successors, then
446
0
          // follow them in reverse.  This gives us some reasonable answer about
447
0
          // the post-dom tree inside any infinite loop. In particular, it
448
0
          // guarantees we get to the farthest away point along *some*
449
0
          // path. This also matches the GCC's behavior.
450
0
          // If we really wanted a totally complete picture of dominance inside
451
0
          // this infinite loop, we could do it with SCC-like algorithms to find
452
0
          // the lowest and highest points in the infinite loop.  In theory, it
453
0
          // would be nice to give the canonical backedge for the loop, but it's
454
0
          // expensive and does not always lead to a minimal set of roots.
455
0
          LLVM_DEBUG(dbgs() << "\t\t\tRunning forward DFS\n");
456
0
457
0
          const unsigned NewNum = SNCA.runDFS<true>(I, Num, AlwaysDescend, Num);
458
0
          const NodePtr FurthestAway = SNCA.NumToNode[NewNum];
459
0
          LLVM_DEBUG(dbgs() << "\t\t\tFound a new furthest away node "
460
0
                            << "(non-trivial root): "
461
0
                            << BlockNamePrinter(FurthestAway) << "\n");
462
0
          ConnectToExitBlock.insert(FurthestAway);
463
0
          Roots.push_back(FurthestAway);
464
0
          LLVM_DEBUG(dbgs() << "\t\t\tPrev DFSNum: " << Num << ", new DFSNum: "
465
0
                            << NewNum << "\n\t\t\tRemoving DFS info\n");
466
0
          for (unsigned i = NewNum; i > Num; --i) {
467
0
            const NodePtr N = SNCA.NumToNode[i];
468
0
            LLVM_DEBUG(dbgs() << "\t\t\t\tRemoving DFS info for "
469
0
                              << BlockNamePrinter(N) << "\n");
470
0
            SNCA.NodeToInfo.erase(N);
471
0
            SNCA.NumToNode.pop_back();
472
0
          }
473
0
          const unsigned PrevNum = Num;
474
0
          LLVM_DEBUG(dbgs() << "\t\t\tRunning reverse DFS\n");
475
0
          Num = SNCA.runDFS(FurthestAway, Num, AlwaysDescend, 1);
476
0
          for (unsigned i = PrevNum + 1; i <= Num; ++i)
477
0
            LLVM_DEBUG(dbgs() << "\t\t\t\tfound node "
478
0
                              << BlockNamePrinter(SNCA.NumToNode[i]) << "\n");
479
0
        }
480
0
      }
481
0
    }
482
0
483
0
    LLVM_DEBUG(dbgs() << "Total: " << Total << ", Num: " << Num << "\n");
484
0
    LLVM_DEBUG(dbgs() << "Discovered CFG nodes:\n");
485
0
    LLVM_DEBUG(for (size_t i = 0; i <= Num; ++i) dbgs()
486
0
               << i << ": " << BlockNamePrinter(SNCA.NumToNode[i]) << "\n");
487
0
488
0
    assert((Total + 1 == Num) && "Everything should have been visited");
489
0
490
0
    // Step #3: If we found some non-trivial roots, make them non-redundant.
491
0
    if (HasNonTrivialRoots) RemoveRedundantRoots(DT, BUI, Roots);
492
0
493
0
    LLVM_DEBUG(dbgs() << "Found roots: ");
494
0
    LLVM_DEBUG(for (auto *Root
495
0
                    : Roots) dbgs()
496
0
               << BlockNamePrinter(Root) << " ");
497
0
    LLVM_DEBUG(dbgs() << "\n");
498
0
499
0
    return Roots;
500
0
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, true> >::FindRoots(llvm::DominatorTreeBase<clang::CFGBlock, true> const&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, true> >::BatchUpdateInfo*)
Line
Count
Source
383
107
  static RootsT FindRoots(const DomTreeT &DT, BatchUpdatePtr BUI) {
384
107
    assert(DT.Parent && "Parent pointer is not set");
385
107
    RootsT Roots;
386
107
387
107
    // For dominators, function entry CFG node is always a tree root node.
388
107
    if (!IsPostDom) {
389
0
      Roots.push_back(GetEntryNode(DT));
390
0
      return Roots;
391
0
    }
392
107
393
107
    SemiNCAInfo SNCA(BUI);
394
107
395
107
    // PostDominatorTree always has a virtual root.
396
107
    SNCA.addVirtualRoot();
397
107
    unsigned Num = 1;
398
107
399
107
    LLVM_DEBUG(dbgs() << "\t\tLooking for trivial roots\n");
400
107
401
107
    // Step #1: Find all the trivial roots that are going to will definitely
402
107
    // remain tree roots.
403
107
    unsigned Total = 0;
404
107
    // It may happen that there are some new nodes in the CFG that are result of
405
107
    // the ongoing batch update, but we cannot really pretend that they don't
406
107
    // exist -- we won't see any outgoing or incoming edges to them, so it's
407
107
    // fine to discover them here, as they would end up appearing in the CFG at
408
107
    // some point anyway.
409
549
    for (const NodePtr N : nodes(DT.Parent)) {
410
549
      ++Total;
411
549
      // If it has no *successors*, it is definitely a root.
412
549
      if (!HasForwardSuccessors(N, BUI)) {
413
107
        Roots.push_back(N);
414
107
        // Run DFS not to walk this part of CFG later.
415
107
        Num = SNCA.runDFS(N, Num, AlwaysDescend, 1);
416
107
        LLVM_DEBUG(dbgs() << "Found a new trivial root: " << BlockNamePrinter(N)
417
107
                          << "\n");
418
107
        LLVM_DEBUG(dbgs() << "Last visited node: "
419
107
                          << BlockNamePrinter(SNCA.NumToNode[Num]) << "\n");
420
107
      }
421
549
    }
422
107
423
107
    LLVM_DEBUG(dbgs() << "\t\tLooking for non-trivial roots\n");
424
107
425
107
    // Step #2: Find all non-trivial root candidates. Those are CFG nodes that
426
107
    // are reverse-unreachable were not visited by previous DFS walks (i.e. CFG
427
107
    // nodes in infinite loops).
428
107
    bool HasNonTrivialRoots = false;
429
107
    // Accounting for the virtual exit, see if we had any reverse-unreachable
430
107
    // nodes.
431
107
    if (Total + 1 != Num) {
432
0
      HasNonTrivialRoots = true;
433
0
      // Make another DFS pass over all other nodes to find the
434
0
      // reverse-unreachable blocks, and find the furthest paths we'll be able
435
0
      // to make.
436
0
      // Note that this looks N^2, but it's really 2N worst case, if every node
437
0
      // is unreachable. This is because we are still going to only visit each
438
0
      // unreachable node once, we may just visit it in two directions,
439
0
      // depending on how lucky we get.
440
0
      SmallPtrSet<NodePtr, 4> ConnectToExitBlock;
441
0
      for (const NodePtr I : nodes(DT.Parent)) {
442
0
        if (SNCA.NodeToInfo.count(I) == 0) {
443
0
          LLVM_DEBUG(dbgs()
444
0
                     << "\t\t\tVisiting node " << BlockNamePrinter(I) << "\n");
445
0
          // Find the furthest away we can get by following successors, then
446
0
          // follow them in reverse.  This gives us some reasonable answer about
447
0
          // the post-dom tree inside any infinite loop. In particular, it
448
0
          // guarantees we get to the farthest away point along *some*
449
0
          // path. This also matches the GCC's behavior.
450
0
          // If we really wanted a totally complete picture of dominance inside
451
0
          // this infinite loop, we could do it with SCC-like algorithms to find
452
0
          // the lowest and highest points in the infinite loop.  In theory, it
453
0
          // would be nice to give the canonical backedge for the loop, but it's
454
0
          // expensive and does not always lead to a minimal set of roots.
455
0
          LLVM_DEBUG(dbgs() << "\t\t\tRunning forward DFS\n");
456
0
457
0
          const unsigned NewNum = SNCA.runDFS<true>(I, Num, AlwaysDescend, Num);
458
0
          const NodePtr FurthestAway = SNCA.NumToNode[NewNum];
459
0
          LLVM_DEBUG(dbgs() << "\t\t\tFound a new furthest away node "
460
0
                            << "(non-trivial root): "
461
0
                            << BlockNamePrinter(FurthestAway) << "\n");
462
0
          ConnectToExitBlock.insert(FurthestAway);
463
0
          Roots.push_back(FurthestAway);
464
0
          LLVM_DEBUG(dbgs() << "\t\t\tPrev DFSNum: " << Num << ", new DFSNum: "
465
0
                            << NewNum << "\n\t\t\tRemoving DFS info\n");
466
0
          for (unsigned i = NewNum; i > Num; --i) {
467
0
            const NodePtr N = SNCA.NumToNode[i];
468
0
            LLVM_DEBUG(dbgs() << "\t\t\t\tRemoving DFS info for "
469
0
                              << BlockNamePrinter(N) << "\n");
470
0
            SNCA.NodeToInfo.erase(N);
471
0
            SNCA.NumToNode.pop_back();
472
0
          }
473
0
          const unsigned PrevNum = Num;
474
0
          LLVM_DEBUG(dbgs() << "\t\t\tRunning reverse DFS\n");
475
0
          Num = SNCA.runDFS(FurthestAway, Num, AlwaysDescend, 1);
476
0
          for (unsigned i = PrevNum + 1; i <= Num; ++i)
477
0
            LLVM_DEBUG(dbgs() << "\t\t\t\tfound node "
478
0
                              << BlockNamePrinter(SNCA.NumToNode[i]) << "\n");
479
0
        }
480
0
      }
481
0
    }
482
107
483
107
    LLVM_DEBUG(dbgs() << "Total: " << Total << ", Num: " << Num << "\n");
484
107
    LLVM_DEBUG(dbgs() << "Discovered CFG nodes:\n");
485
107
    LLVM_DEBUG(for (size_t i = 0; i <= Num; ++i) dbgs()
486
107
               << i << ": " << BlockNamePrinter(SNCA.NumToNode[i]) << "\n");
487
107
488
107
    assert((Total + 1 == Num) && "Everything should have been visited");
489
107
490
107
    // Step #3: If we found some non-trivial roots, make them non-redundant.
491
107
    if (HasNonTrivialRoots) 
RemoveRedundantRoots(DT, BUI, Roots)0
;
492
107
493
107
    LLVM_DEBUG(dbgs() << "Found roots: ");
494
107
    LLVM_DEBUG(for (auto *Root
495
107
                    : Roots) dbgs()
496
107
               << BlockNamePrinter(Root) << " ");
497
107
    LLVM_DEBUG(dbgs() << "\n");
498
107
499
107
    return Roots;
500
107
  }
501
502
  // This function only makes sense for postdominators.
503
  // We define roots to be some set of CFG nodes where (reverse) DFS walks have
504
  // to start in order to visit all the CFG nodes (including the
505
  // reverse-unreachable ones).
506
  // When the search for non-trivial roots is done it may happen that some of
507
  // the non-trivial roots are reverse-reachable from other non-trivial roots,
508
  // which makes them redundant. This function removes them from the set of
509
  // input roots.
510
  static void RemoveRedundantRoots(const DomTreeT &DT, BatchUpdatePtr BUI,
511
1.80k
                                   RootsT &Roots) {
512
1.80k
    assert(IsPostDom && "This function is for postdominators only");
513
1.80k
    LLVM_DEBUG(dbgs() << "Removing redundant roots\n");
514
1.80k
515
1.80k
    SemiNCAInfo SNCA(BUI);
516
1.80k
517
5.08k
    for (unsigned i = 0; i < Roots.size(); 
++i3.28k
) {
518
3.28k
      auto &Root = Roots[i];
519
3.28k
      // Trivial roots are always non-redundant.
520
3.28k
      if (!HasForwardSuccessors(Root, BUI)) 
continue1.29k
;
521
1.99k
      LLVM_DEBUG(dbgs() << "\tChecking if " << BlockNamePrinter(Root)
522
1.99k
                        << " remains a root\n");
523
1.99k
      SNCA.clear();
524
1.99k
      // Do a forward walk looking for the other roots.
525
1.99k
      const unsigned Num = SNCA.runDFS<true>(Root, 0, AlwaysDescend, 0);
526
1.99k
      // Skip the start node and begin from the second one (note that DFS uses
527
1.99k
      // 1-based indexing).
528
3.95k
      for (unsigned x = 2; x <= Num; 
++x1.96k
) {
529
2.04k
        const NodePtr N = SNCA.NumToNode[x];
530
2.04k
        // If we wound another root in a (forward) DFS walk, remove the current
531
2.04k
        // root from the set of roots, as it is reverse-reachable from the other
532
2.04k
        // one.
533
2.04k
        if (llvm::find(Roots, N) != Roots.end()) {
534
79
          LLVM_DEBUG(dbgs() << "\tForward DFS walk found another root "
535
79
                            << BlockNamePrinter(N) << "\n\tRemoving root "
536
79
                            << BlockNamePrinter(Root) << "\n");
537
79
          std::swap(Root, Roots.back());
538
79
          Roots.pop_back();
539
79
540
79
          // Root at the back takes the current root's place.
541
79
          // Start the next loop iteration with the same index.
542
79
          --i;
543
79
          break;
544
79
        }
545
2.04k
      }
546
1.99k
    }
547
1.80k
  }
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::RemoveRedundantRoots(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> const&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::BatchUpdateInfo*, llvm::SmallVector<llvm::MachineBasicBlock*, 1u>&)
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::RemoveRedundantRoots(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> const&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::BatchUpdateInfo*, llvm::SmallVector<llvm::MachineBasicBlock*, 4u>&)
Line
Count
Source
511
1.29k
                                   RootsT &Roots) {
512
1.29k
    assert(IsPostDom && "This function is for postdominators only");
513
1.29k
    LLVM_DEBUG(dbgs() << "Removing redundant roots\n");
514
1.29k
515
1.29k
    SemiNCAInfo SNCA(BUI);
516
1.29k
517
3.42k
    for (unsigned i = 0; i < Roots.size(); 
++i2.13k
) {
518
2.13k
      auto &Root = Roots[i];
519
2.13k
      // Trivial roots are always non-redundant.
520
2.13k
      if (!HasForwardSuccessors(Root, BUI)) 
continue744
;
521
1.38k
      LLVM_DEBUG(dbgs() << "\tChecking if " << BlockNamePrinter(Root)
522
1.38k
                        << " remains a root\n");
523
1.38k
      SNCA.clear();
524
1.38k
      // Do a forward walk looking for the other roots.
525
1.38k
      const unsigned Num = SNCA.runDFS<true>(Root, 0, AlwaysDescend, 0);
526
1.38k
      // Skip the start node and begin from the second one (note that DFS uses
527
1.38k
      // 1-based indexing).
528
2.85k
      for (unsigned x = 2; x <= Num; 
++x1.47k
) {
529
1.51k
        const NodePtr N = SNCA.NumToNode[x];
530
1.51k
        // If we wound another root in a (forward) DFS walk, remove the current
531
1.51k
        // root from the set of roots, as it is reverse-reachable from the other
532
1.51k
        // one.
533
1.51k
        if (llvm::find(Roots, N) != Roots.end()) {
534
39
          LLVM_DEBUG(dbgs() << "\tForward DFS walk found another root "
535
39
                            << BlockNamePrinter(N) << "\n\tRemoving root "
536
39
                            << BlockNamePrinter(Root) << "\n");
537
39
          std::swap(Root, Roots.back());
538
39
          Roots.pop_back();
539
39
540
39
          // Root at the back takes the current root's place.
541
39
          // Start the next loop iteration with the same index.
542
39
          --i;
543
39
          break;
544
39
        }
545
1.51k
      }
546
1.38k
    }
547
1.29k
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::RemoveRedundantRoots(llvm::DominatorTreeBase<llvm::BasicBlock, true> const&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::BatchUpdateInfo*, llvm::SmallVector<llvm::BasicBlock*, 4u>&)
Line
Count
Source
511
509
                                   RootsT &Roots) {
512
509
    assert(IsPostDom && "This function is for postdominators only");
513
509
    LLVM_DEBUG(dbgs() << "Removing redundant roots\n");
514
509
515
509
    SemiNCAInfo SNCA(BUI);
516
509
517
1.66k
    for (unsigned i = 0; i < Roots.size(); 
++i1.15k
) {
518
1.15k
      auto &Root = Roots[i];
519
1.15k
      // Trivial roots are always non-redundant.
520
1.15k
      if (!HasForwardSuccessors(Root, BUI)) 
continue547
;
521
606
      LLVM_DEBUG(dbgs() << "\tChecking if " << BlockNamePrinter(Root)
522
606
                        << " remains a root\n");
523
606
      SNCA.clear();
524
606
      // Do a forward walk looking for the other roots.
525
606
      const unsigned Num = SNCA.runDFS<true>(Root, 0, AlwaysDescend, 0);
526
606
      // Skip the start node and begin from the second one (note that DFS uses
527
606
      // 1-based indexing).
528
1.10k
      for (unsigned x = 2; x <= Num; 
++x495
) {
529
535
        const NodePtr N = SNCA.NumToNode[x];
530
535
        // If we wound another root in a (forward) DFS walk, remove the current
531
535
        // root from the set of roots, as it is reverse-reachable from the other
532
535
        // one.
533
535
        if (llvm::find(Roots, N) != Roots.end()) {
534
40
          LLVM_DEBUG(dbgs() << "\tForward DFS walk found another root "
535
40
                            << BlockNamePrinter(N) << "\n\tRemoving root "
536
40
                            << BlockNamePrinter(Root) << "\n");
537
40
          std::swap(Root, Roots.back());
538
40
          Roots.pop_back();
539
40
540
40
          // Root at the back takes the current root's place.
541
40
          // Start the next loop iteration with the same index.
542
40
          --i;
543
40
          break;
544
40
        }
545
535
      }
546
606
    }
547
509
  }
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::RemoveRedundantRoots(llvm::DominatorTreeBase<llvm::BasicBlock, false> const&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::BatchUpdateInfo*, llvm::SmallVector<llvm::BasicBlock*, 1u>&)
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::RemoveRedundantRoots(llvm::DominatorTreeBase<llvm::VPBlockBase, false> const&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::BatchUpdateInfo*, llvm::SmallVector<llvm::VPBlockBase*, 1u>&)
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, true> >::RemoveRedundantRoots(llvm::DominatorTreeBase<clang::CFGBlock, true> const&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, true> >::BatchUpdateInfo*, llvm::SmallVector<clang::CFGBlock*, 4u>&)
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, false> >::RemoveRedundantRoots(llvm::DominatorTreeBase<clang::CFGBlock, false> const&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, false> >::BatchUpdateInfo*, llvm::SmallVector<clang::CFGBlock*, 1u>&)
548
549
  template <typename DescendCondition>
550
15.1M
  void doFullDFSWalk(const DomTreeT &DT, DescendCondition DC) {
551
15.1M
    if (!IsPostDom) {
552
13.0M
      assert(DT.Roots.size() == 1 && "Dominators should have a singe root");
553
13.0M
      runDFS(DT.Roots[0], 0, DC, 0);
554
13.0M
      return;
555
13.0M
    }
556
2.11M
557
2.11M
    addVirtualRoot();
558
2.11M
    unsigned Num = 1;
559
2.60M
    for (const NodePtr Root : DT.Roots) Num = runDFS(Root, Num, DC, 0);
560
2.11M
  }
void llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::doFullDFSWalk<bool (*)(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)>(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> const&, bool (*)(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*))
Line
Count
Source
550
2.61M
  void doFullDFSWalk(const DomTreeT &DT, DescendCondition DC) {
551
2.61M
    if (!IsPostDom) {
552
2.61M
      assert(DT.Roots.size() == 1 && "Dominators should have a singe root");
553
2.61M
      runDFS(DT.Roots[0], 0, DC, 0);
554
2.61M
      return;
555
2.61M
    }
556
0
557
0
    addVirtualRoot();
558
0
    unsigned Num = 1;
559
0
    for (const NodePtr Root : DT.Roots) Num = runDFS(Root, Num, DC, 0);
560
0
  }
Unexecuted instantiation: void llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::doFullDFSWalk<llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::verifyParentProperty(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> const&)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)>(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> const&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::verifyParentProperty(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> const&)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*))
Unexecuted instantiation: void llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::doFullDFSWalk<llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::verifySiblingProperty(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> const&)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)>(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> const&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::verifySiblingProperty(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> const&)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*))
void llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::doFullDFSWalk<bool (*)(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)>(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> const&, bool (*)(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*))
Line
Count
Source
550
1.50M
  void doFullDFSWalk(const DomTreeT &DT, DescendCondition DC) {
551
1.50M
    if (!IsPostDom) {
552
0
      assert(DT.Roots.size() == 1 && "Dominators should have a singe root");
553
0
      runDFS(DT.Roots[0], 0, DC, 0);
554
0
      return;
555
0
    }
556
1.50M
557
1.50M
    addVirtualRoot();
558
1.50M
    unsigned Num = 1;
559
1.92M
    for (const NodePtr Root : DT.Roots) Num = runDFS(Root, Num, DC, 0);
560
1.50M
  }
Unexecuted instantiation: void llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::doFullDFSWalk<llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::verifyParentProperty(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> const&)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)>(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> const&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::verifyParentProperty(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> const&)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*))
Unexecuted instantiation: void llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::doFullDFSWalk<llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::verifySiblingProperty(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> const&)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)>(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> const&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::verifySiblingProperty(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> const&)::'lambda'(llvm::MachineBasicBlock*, llvm::MachineBasicBlock*))
void llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::doFullDFSWalk<bool (*)(llvm::BasicBlock*, llvm::BasicBlock*)>(llvm::DominatorTreeBase<llvm::BasicBlock, false> const&, bool (*)(llvm::BasicBlock*, llvm::BasicBlock*))
Line
Count
Source
550
10.3M
  void doFullDFSWalk(const DomTreeT &DT, DescendCondition DC) {
551
10.3M
    if (!IsPostDom) {
552
10.3M
      assert(DT.Roots.size() == 1 && "Dominators should have a singe root");
553
10.3M
      runDFS(DT.Roots[0], 0, DC, 0);
554
10.3M
      return;
555
10.3M
    }
556
0
557
0
    addVirtualRoot();
558
0
    unsigned Num = 1;
559
0
    for (const NodePtr Root : DT.Roots) Num = runDFS(Root, Num, DC, 0);
560
0
  }
void llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::doFullDFSWalk<bool (*)(llvm::BasicBlock*, llvm::BasicBlock*)>(llvm::DominatorTreeBase<llvm::BasicBlock, true> const&, bool (*)(llvm::BasicBlock*, llvm::BasicBlock*))
Line
Count
Source
550
605k
  void doFullDFSWalk(const DomTreeT &DT, DescendCondition DC) {
551
605k
    if (!IsPostDom) {
552
0
      assert(DT.Roots.size() == 1 && "Dominators should have a singe root");
553
0
      runDFS(DT.Roots[0], 0, DC, 0);
554
0
      return;
555
0
    }
556
605k
557
605k
    addVirtualRoot();
558
605k
    unsigned Num = 1;
559
663k
    for (const NodePtr Root : DT.Roots) Num = runDFS(Root, Num, DC, 0);
560
605k
  }
void llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::doFullDFSWalk<llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::verifyParentProperty(llvm::DominatorTreeBase<llvm::BasicBlock, false> const&)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*)>(llvm::DominatorTreeBase<llvm::BasicBlock, false> const&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::verifyParentProperty(llvm::DominatorTreeBase<llvm::BasicBlock, false> const&)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*))
Line
Count
Source
550
1.73k
  void doFullDFSWalk(const DomTreeT &DT, DescendCondition DC) {
551
1.73k
    if (!IsPostDom) {
552
1.73k
      assert(DT.Roots.size() == 1 && "Dominators should have a singe root");
553
1.73k
      runDFS(DT.Roots[0], 0, DC, 0);
554
1.73k
      return;
555
1.73k
    }
556
0
557
0
    addVirtualRoot();
558
0
    unsigned Num = 1;
559
0
    for (const NodePtr Root : DT.Roots) Num = runDFS(Root, Num, DC, 0);
560
0
  }
void llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::doFullDFSWalk<llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::verifySiblingProperty(llvm::DominatorTreeBase<llvm::BasicBlock, false> const&)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*)>(llvm::DominatorTreeBase<llvm::BasicBlock, false> const&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::verifySiblingProperty(llvm::DominatorTreeBase<llvm::BasicBlock, false> const&)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*))
Line
Count
Source
550
2.46k
  void doFullDFSWalk(const DomTreeT &DT, DescendCondition DC) {
551
2.46k
    if (!IsPostDom) {
552
2.46k
      assert(DT.Roots.size() == 1 && "Dominators should have a singe root");
553
2.46k
      runDFS(DT.Roots[0], 0, DC, 0);
554
2.46k
      return;
555
2.46k
    }
556
0
557
0
    addVirtualRoot();
558
0
    unsigned Num = 1;
559
0
    for (const NodePtr Root : DT.Roots) Num = runDFS(Root, Num, DC, 0);
560
0
  }
void llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::doFullDFSWalk<llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::verifyParentProperty(llvm::DominatorTreeBase<llvm::BasicBlock, true> const&)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*)>(llvm::DominatorTreeBase<llvm::BasicBlock, true> const&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::verifyParentProperty(llvm::DominatorTreeBase<llvm::BasicBlock, true> const&)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*))
Line
Count
Source
550
1.70k
  void doFullDFSWalk(const DomTreeT &DT, DescendCondition DC) {
551
1.70k
    if (!IsPostDom) {
552
0
      assert(DT.Roots.size() == 1 && "Dominators should have a singe root");
553
0
      runDFS(DT.Roots[0], 0, DC, 0);
554
0
      return;
555
0
    }
556
1.70k
557
1.70k
    addVirtualRoot();
558
1.70k
    unsigned Num = 1;
559
5.13k
    for (const NodePtr Root : DT.Roots) Num = runDFS(Root, Num, DC, 0);
560
1.70k
  }
void llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::doFullDFSWalk<llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::verifySiblingProperty(llvm::DominatorTreeBase<llvm::BasicBlock, true> const&)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*)>(llvm::DominatorTreeBase<llvm::BasicBlock, true> const&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::verifySiblingProperty(llvm::DominatorTreeBase<llvm::BasicBlock, true> const&)::'lambda'(llvm::BasicBlock*, llvm::BasicBlock*))
Line
Count
Source
550
2.05k
  void doFullDFSWalk(const DomTreeT &DT, DescendCondition DC) {
551
2.05k
    if (!IsPostDom) {
552
0
      assert(DT.Roots.size() == 1 && "Dominators should have a singe root");
553
0
      runDFS(DT.Roots[0], 0, DC, 0);
554
0
      return;
555
0
    }
556
2.05k
557
2.05k
    addVirtualRoot();
558
2.05k
    unsigned Num = 1;
559
6.04k
    for (const NodePtr Root : DT.Roots) Num = runDFS(Root, Num, DC, 0);
560
2.05k
  }
void llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::doFullDFSWalk<bool (*)(llvm::VPBlockBase*, llvm::VPBlockBase*)>(llvm::DominatorTreeBase<llvm::VPBlockBase, false> const&, bool (*)(llvm::VPBlockBase*, llvm::VPBlockBase*))
Line
Count
Source
550
28
  void doFullDFSWalk(const DomTreeT &DT, DescendCondition DC) {
551
28
    if (!IsPostDom) {
552
28
      assert(DT.Roots.size() == 1 && "Dominators should have a singe root");
553
28
      runDFS(DT.Roots[0], 0, DC, 0);
554
28
      return;
555
28
    }
556
0
557
0
    addVirtualRoot();
558
0
    unsigned Num = 1;
559
0
    for (const NodePtr Root : DT.Roots) Num = runDFS(Root, Num, DC, 0);
560
0
  }
void llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, false> >::doFullDFSWalk<bool (*)(clang::CFGBlock*, clang::CFGBlock*)>(llvm::DominatorTreeBase<clang::CFGBlock, false> const&, bool (*)(clang::CFGBlock*, clang::CFGBlock*))
Line
Count
Source
550
8
  void doFullDFSWalk(const DomTreeT &DT, DescendCondition DC) {
551
8
    if (!IsPostDom) {
552
8
      assert(DT.Roots.size() == 1 && "Dominators should have a singe root");
553
8
      runDFS(DT.Roots[0], 0, DC, 0);
554
8
      return;
555
8
    }
556
0
557
0
    addVirtualRoot();
558
0
    unsigned Num = 1;
559
0
    for (const NodePtr Root : DT.Roots) Num = runDFS(Root, Num, DC, 0);
560
0
  }
void llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, true> >::doFullDFSWalk<bool (*)(clang::CFGBlock*, clang::CFGBlock*)>(llvm::DominatorTreeBase<clang::CFGBlock, true> const&, bool (*)(clang::CFGBlock*, clang::CFGBlock*))
Line
Count
Source
550
107
  void doFullDFSWalk(const DomTreeT &DT, DescendCondition DC) {
551
107
    if (!IsPostDom) {
552
0
      assert(DT.Roots.size() == 1 && "Dominators should have a singe root");
553
0
      runDFS(DT.Roots[0], 0, DC, 0);
554
0
      return;
555
0
    }
556
107
557
107
    addVirtualRoot();
558
107
    unsigned Num = 1;
559
107
    for (const NodePtr Root : DT.Roots) Num = runDFS(Root, Num, DC, 0);
560
107
  }
561
562
15.1M
  static void CalculateFromScratch(DomTreeT &DT, BatchUpdatePtr BUI) {
563
15.1M
    auto *Parent = DT.Parent;
564
15.1M
    DT.reset();
565
15.1M
    DT.Parent = Parent;
566
15.1M
    SemiNCAInfo SNCA(nullptr);  // Since we are rebuilding the whole tree,
567
15.1M
                                // there's no point doing it incrementally.
568
15.1M
569
15.1M
    // Step #0: Number blocks in depth-first order and initialize variables used
570
15.1M
    // in later stages of the algorithm.
571
15.1M
    DT.Roots = FindRoots(DT, nullptr);
572
15.1M
    SNCA.doFullDFSWalk(DT, AlwaysDescend);
573
15.1M
574
15.1M
    SNCA.runSemiNCA(DT);
575
15.1M
    if (BUI) {
576
165k
      BUI->IsRecalculated = true;
577
165k
      LLVM_DEBUG(
578
165k
          dbgs() << "DomTree recalculated, skipping future batch updates\n");
579
165k
    }
580
15.1M
581
15.1M
    if (DT.Roots.empty()) 
return0
;
582
15.1M
583
15.1M
    // Add a node for the root. If the tree is a PostDominatorTree it will be
584
15.1M
    // the virtual exit (denoted by (BasicBlock *) nullptr) which postdominates
585
15.1M
    // all real exits (including multiple exit blocks, infinite loops).
586
15.1M
    NodePtr Root = IsPostDom ? 
nullptr2.11M
:
DT.Roots[0]13.0M
;
587
15.1M
588
15.1M
    DT.RootNode = (DT.DomTreeNodes[Root] =
589
15.1M
                       llvm::make_unique<DomTreeNodeBase<NodeT>>(Root, nullptr))
590
15.1M
        .get();
591
15.1M
    SNCA.attachNewSubtree(DT, DT.RootNode);
592
15.1M
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::CalculateFromScratch(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::BatchUpdateInfo*)
Line
Count
Source
562
2.61M
  static void CalculateFromScratch(DomTreeT &DT, BatchUpdatePtr BUI) {
563
2.61M
    auto *Parent = DT.Parent;
564
2.61M
    DT.reset();
565
2.61M
    DT.Parent = Parent;
566
2.61M
    SemiNCAInfo SNCA(nullptr);  // Since we are rebuilding the whole tree,
567
2.61M
                                // there's no point doing it incrementally.
568
2.61M
569
2.61M
    // Step #0: Number blocks in depth-first order and initialize variables used
570
2.61M
    // in later stages of the algorithm.
571
2.61M
    DT.Roots = FindRoots(DT, nullptr);
572
2.61M
    SNCA.doFullDFSWalk(DT, AlwaysDescend);
573
2.61M
574
2.61M
    SNCA.runSemiNCA(DT);
575
2.61M
    if (BUI) {
576
0
      BUI->IsRecalculated = true;
577
0
      LLVM_DEBUG(
578
0
          dbgs() << "DomTree recalculated, skipping future batch updates\n");
579
0
    }
580
2.61M
581
2.61M
    if (DT.Roots.empty()) 
return0
;
582
2.61M
583
2.61M
    // Add a node for the root. If the tree is a PostDominatorTree it will be
584
2.61M
    // the virtual exit (denoted by (BasicBlock *) nullptr) which postdominates
585
2.61M
    // all real exits (including multiple exit blocks, infinite loops).
586
2.61M
    NodePtr Root = IsPostDom ? 
nullptr0
: DT.Roots[0];
587
2.61M
588
2.61M
    DT.RootNode = (DT.DomTreeNodes[Root] =
589
2.61M
                       llvm::make_unique<DomTreeNodeBase<NodeT>>(Root, nullptr))
590
2.61M
        .get();
591
2.61M
    SNCA.attachNewSubtree(DT, DT.RootNode);
592
2.61M
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::CalculateFromScratch(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::BatchUpdateInfo*)
Line
Count
Source
562
1.50M
  static void CalculateFromScratch(DomTreeT &DT, BatchUpdatePtr BUI) {
563
1.50M
    auto *Parent = DT.Parent;
564
1.50M
    DT.reset();
565
1.50M
    DT.Parent = Parent;
566
1.50M
    SemiNCAInfo SNCA(nullptr);  // Since we are rebuilding the whole tree,
567
1.50M
                                // there's no point doing it incrementally.
568
1.50M
569
1.50M
    // Step #0: Number blocks in depth-first order and initialize variables used
570
1.50M
    // in later stages of the algorithm.
571
1.50M
    DT.Roots = FindRoots(DT, nullptr);
572
1.50M
    SNCA.doFullDFSWalk(DT, AlwaysDescend);
573
1.50M
574
1.50M
    SNCA.runSemiNCA(DT);
575
1.50M
    if (BUI) {
576
0
      BUI->IsRecalculated = true;
577
0
      LLVM_DEBUG(
578
0
          dbgs() << "DomTree recalculated, skipping future batch updates\n");
579
0
    }
580
1.50M
581
1.50M
    if (DT.Roots.empty()) 
return0
;
582
1.50M
583
1.50M
    // Add a node for the root. If the tree is a PostDominatorTree it will be
584
1.50M
    // the virtual exit (denoted by (BasicBlock *) nullptr) which postdominates
585
1.50M
    // all real exits (including multiple exit blocks, infinite loops).
586
18.4E
    
NodePtr Root = IsPostDom 1.50M
?
nullptr1.50M
: DT.Roots[0];
587
1.50M
588
1.50M
    DT.RootNode = (DT.DomTreeNodes[Root] =
589
1.50M
                       llvm::make_unique<DomTreeNodeBase<NodeT>>(Root, nullptr))
590
1.50M
        .get();
591
1.50M
    SNCA.attachNewSubtree(DT, DT.RootNode);
592
1.50M
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::CalculateFromScratch(llvm::DominatorTreeBase<llvm::BasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::BatchUpdateInfo*)
Line
Count
Source
562
10.3M
  static void CalculateFromScratch(DomTreeT &DT, BatchUpdatePtr BUI) {
563
10.3M
    auto *Parent = DT.Parent;
564
10.3M
    DT.reset();
565
10.3M
    DT.Parent = Parent;
566
10.3M
    SemiNCAInfo SNCA(nullptr);  // Since we are rebuilding the whole tree,
567
10.3M
                                // there's no point doing it incrementally.
568
10.3M
569
10.3M
    // Step #0: Number blocks in depth-first order and initialize variables used
570
10.3M
    // in later stages of the algorithm.
571
10.3M
    DT.Roots = FindRoots(DT, nullptr);
572
10.3M
    SNCA.doFullDFSWalk(DT, AlwaysDescend);
573
10.3M
574
10.3M
    SNCA.runSemiNCA(DT);
575
10.3M
    if (BUI) {
576
165k
      BUI->IsRecalculated = true;
577
165k
      LLVM_DEBUG(
578
165k
          dbgs() << "DomTree recalculated, skipping future batch updates\n");
579
165k
    }
580
10.3M
581
10.3M
    if (DT.Roots.empty()) 
return0
;
582
10.3M
583
10.3M
    // Add a node for the root. If the tree is a PostDominatorTree it will be
584
10.3M
    // the virtual exit (denoted by (BasicBlock *) nullptr) which postdominates
585
10.3M
    // all real exits (including multiple exit blocks, infinite loops).
586
10.3M
    NodePtr Root = IsPostDom ? 
nullptr0
: DT.Roots[0];
587
10.3M
588
10.3M
    DT.RootNode = (DT.DomTreeNodes[Root] =
589
10.3M
                       llvm::make_unique<DomTreeNodeBase<NodeT>>(Root, nullptr))
590
10.3M
        .get();
591
10.3M
    SNCA.attachNewSubtree(DT, DT.RootNode);
592
10.3M
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::CalculateFromScratch(llvm::DominatorTreeBase<llvm::BasicBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::BatchUpdateInfo*)
Line
Count
Source
562
605k
  static void CalculateFromScratch(DomTreeT &DT, BatchUpdatePtr BUI) {
563
605k
    auto *Parent = DT.Parent;
564
605k
    DT.reset();
565
605k
    DT.Parent = Parent;
566
605k
    SemiNCAInfo SNCA(nullptr);  // Since we are rebuilding the whole tree,
567
605k
                                // there's no point doing it incrementally.
568
605k
569
605k
    // Step #0: Number blocks in depth-first order and initialize variables used
570
605k
    // in later stages of the algorithm.
571
605k
    DT.Roots = FindRoots(DT, nullptr);
572
605k
    SNCA.doFullDFSWalk(DT, AlwaysDescend);
573
605k
574
605k
    SNCA.runSemiNCA(DT);
575
605k
    if (BUI) {
576
56
      BUI->IsRecalculated = true;
577
56
      LLVM_DEBUG(
578
56
          dbgs() << "DomTree recalculated, skipping future batch updates\n");
579
56
    }
580
605k
581
605k
    if (DT.Roots.empty()) 
return0
;
582
605k
583
605k
    // Add a node for the root. If the tree is a PostDominatorTree it will be
584
605k
    // the virtual exit (denoted by (BasicBlock *) nullptr) which postdominates
585
605k
    // all real exits (including multiple exit blocks, infinite loops).
586
605k
    NodePtr Root = IsPostDom ? 
nullptr605k
:
DT.Roots[0]3
;
587
605k
588
605k
    DT.RootNode = (DT.DomTreeNodes[Root] =
589
605k
                       llvm::make_unique<DomTreeNodeBase<NodeT>>(Root, nullptr))
590
605k
        .get();
591
605k
    SNCA.attachNewSubtree(DT, DT.RootNode);
592
605k
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::CalculateFromScratch(llvm::DominatorTreeBase<llvm::VPBlockBase, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::BatchUpdateInfo*)
Line
Count
Source
562
28
  static void CalculateFromScratch(DomTreeT &DT, BatchUpdatePtr BUI) {
563
28
    auto *Parent = DT.Parent;
564
28
    DT.reset();
565
28
    DT.Parent = Parent;
566
28
    SemiNCAInfo SNCA(nullptr);  // Since we are rebuilding the whole tree,
567
28
                                // there's no point doing it incrementally.
568
28
569
28
    // Step #0: Number blocks in depth-first order and initialize variables used
570
28
    // in later stages of the algorithm.
571
28
    DT.Roots = FindRoots(DT, nullptr);
572
28
    SNCA.doFullDFSWalk(DT, AlwaysDescend);
573
28
574
28
    SNCA.runSemiNCA(DT);
575
28
    if (BUI) {
576
0
      BUI->IsRecalculated = true;
577
0
      LLVM_DEBUG(
578
0
          dbgs() << "DomTree recalculated, skipping future batch updates\n");
579
0
    }
580
28
581
28
    if (DT.Roots.empty()) 
return0
;
582
28
583
28
    // Add a node for the root. If the tree is a PostDominatorTree it will be
584
28
    // the virtual exit (denoted by (BasicBlock *) nullptr) which postdominates
585
28
    // all real exits (including multiple exit blocks, infinite loops).
586
28
    NodePtr Root = IsPostDom ? 
nullptr0
: DT.Roots[0];
587
28
588
28
    DT.RootNode = (DT.DomTreeNodes[Root] =
589
28
                       llvm::make_unique<DomTreeNodeBase<NodeT>>(Root, nullptr))
590
28
        .get();
591
28
    SNCA.attachNewSubtree(DT, DT.RootNode);
592
28
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, false> >::CalculateFromScratch(llvm::DominatorTreeBase<clang::CFGBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, false> >::BatchUpdateInfo*)
Line
Count
Source
562
8
  static void CalculateFromScratch(DomTreeT &DT, BatchUpdatePtr BUI) {
563
8
    auto *Parent = DT.Parent;
564
8
    DT.reset();
565
8
    DT.Parent = Parent;
566
8
    SemiNCAInfo SNCA(nullptr);  // Since we are rebuilding the whole tree,
567
8
                                // there's no point doing it incrementally.
568
8
569
8
    // Step #0: Number blocks in depth-first order and initialize variables used
570
8
    // in later stages of the algorithm.
571
8
    DT.Roots = FindRoots(DT, nullptr);
572
8
    SNCA.doFullDFSWalk(DT, AlwaysDescend);
573
8
574
8
    SNCA.runSemiNCA(DT);
575
8
    if (BUI) {
576
0
      BUI->IsRecalculated = true;
577
0
      LLVM_DEBUG(
578
0
          dbgs() << "DomTree recalculated, skipping future batch updates\n");
579
0
    }
580
8
581
8
    if (DT.Roots.empty()) 
return0
;
582
8
583
8
    // Add a node for the root. If the tree is a PostDominatorTree it will be
584
8
    // the virtual exit (denoted by (BasicBlock *) nullptr) which postdominates
585
8
    // all real exits (including multiple exit blocks, infinite loops).
586
8
    NodePtr Root = IsPostDom ? 
nullptr0
: DT.Roots[0];
587
8
588
8
    DT.RootNode = (DT.DomTreeNodes[Root] =
589
8
                       llvm::make_unique<DomTreeNodeBase<NodeT>>(Root, nullptr))
590
8
        .get();
591
8
    SNCA.attachNewSubtree(DT, DT.RootNode);
592
8
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, true> >::CalculateFromScratch(llvm::DominatorTreeBase<clang::CFGBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, true> >::BatchUpdateInfo*)
Line
Count
Source
562
107
  static void CalculateFromScratch(DomTreeT &DT, BatchUpdatePtr BUI) {
563
107
    auto *Parent = DT.Parent;
564
107
    DT.reset();
565
107
    DT.Parent = Parent;
566
107
    SemiNCAInfo SNCA(nullptr);  // Since we are rebuilding the whole tree,
567
107
                                // there's no point doing it incrementally.
568
107
569
107
    // Step #0: Number blocks in depth-first order and initialize variables used
570
107
    // in later stages of the algorithm.
571
107
    DT.Roots = FindRoots(DT, nullptr);
572
107
    SNCA.doFullDFSWalk(DT, AlwaysDescend);
573
107
574
107
    SNCA.runSemiNCA(DT);
575
107
    if (BUI) {
576
0
      BUI->IsRecalculated = true;
577
0
      LLVM_DEBUG(
578
0
          dbgs() << "DomTree recalculated, skipping future batch updates\n");
579
0
    }
580
107
581
107
    if (DT.Roots.empty()) 
return0
;
582
107
583
107
    // Add a node for the root. If the tree is a PostDominatorTree it will be
584
107
    // the virtual exit (denoted by (BasicBlock *) nullptr) which postdominates
585
107
    // all real exits (including multiple exit blocks, infinite loops).
586
107
    NodePtr Root = IsPostDom ? nullptr : 
DT.Roots[0]0
;
587
107
588
107
    DT.RootNode = (DT.DomTreeNodes[Root] =
589
107
                       llvm::make_unique<DomTreeNodeBase<NodeT>>(Root, nullptr))
590
107
        .get();
591
107
    SNCA.attachNewSubtree(DT, DT.RootNode);
592
107
  }
593
594
15.2M
  void attachNewSubtree(DomTreeT& DT, const TreeNodePtr AttachTo) {
595
15.2M
    // Attach the first unreachable block to AttachTo.
596
15.2M
    NodeToInfo[NumToNode[1]].IDom = AttachTo->getBlock();
597
15.2M
    // Loop over all of the discovered blocks in the function...
598
105M
    for (size_t i = 1, e = NumToNode.size(); i != e; 
++i89.9M
) {
599
89.9M
      NodePtr W = NumToNode[i];
600
89.9M
      LLVM_DEBUG(dbgs() << "\tdiscovered a new reachable node "
601
89.9M
                        << BlockNamePrinter(W) << "\n");
602
89.9M
603
89.9M
      // Don't replace this with 'count', the insertion side effect is important
604
89.9M
      if (DT.DomTreeNodes[W]) 
continue15.1M
; // Haven't calculated this node yet?
605
74.8M
606
74.8M
      NodePtr ImmDom = getIDom(W);
607
74.8M
608
74.8M
      // Get or calculate the node for the immediate dominator.
609
74.8M
      TreeNodePtr IDomNode = getNodeForBlock(ImmDom, DT);
610
74.8M
611
74.8M
      // Add a new tree node for this BasicBlock, and link it as a child of
612
74.8M
      // IDomNode.
613
74.8M
      DT.DomTreeNodes[W] = IDomNode->addChild(
614
74.8M
          llvm::make_unique<DomTreeNodeBase<NodeT>>(W, IDomNode));
615
74.8M
    }
616
15.2M
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::attachNewSubtree(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false>&, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*)
Line
Count
Source
594
2.61M
  void attachNewSubtree(DomTreeT& DT, const TreeNodePtr AttachTo) {
595
2.61M
    // Attach the first unreachable block to AttachTo.
596
2.61M
    NodeToInfo[NumToNode[1]].IDom = AttachTo->getBlock();
597
2.61M
    // Loop over all of the discovered blocks in the function...
598
14.6M
    for (size_t i = 1, e = NumToNode.size(); i != e; 
++i12.0M
) {
599
12.0M
      NodePtr W = NumToNode[i];
600
12.0M
      LLVM_DEBUG(dbgs() << "\tdiscovered a new reachable node "
601
12.0M
                        << BlockNamePrinter(W) << "\n");
602
12.0M
603
12.0M
      // Don't replace this with 'count', the insertion side effect is important
604
12.0M
      if (DT.DomTreeNodes[W]) 
continue2.61M
; // Haven't calculated this node yet?
605
9.38M
606
9.38M
      NodePtr ImmDom = getIDom(W);
607
9.38M
608
9.38M
      // Get or calculate the node for the immediate dominator.
609
9.38M
      TreeNodePtr IDomNode = getNodeForBlock(ImmDom, DT);
610
9.38M
611
9.38M
      // Add a new tree node for this BasicBlock, and link it as a child of
612
9.38M
      // IDomNode.
613
9.38M
      DT.DomTreeNodes[W] = IDomNode->addChild(
614
9.38M
          llvm::make_unique<DomTreeNodeBase<NodeT>>(W, IDomNode));
615
9.38M
    }
616
2.61M
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::attachNewSubtree(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true>&, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*)
Line
Count
Source
594
1.50M
  void attachNewSubtree(DomTreeT& DT, const TreeNodePtr AttachTo) {
595
1.50M
    // Attach the first unreachable block to AttachTo.
596
1.50M
    NodeToInfo[NumToNode[1]].IDom = AttachTo->getBlock();
597
1.50M
    // Loop over all of the discovered blocks in the function...
598
11.5M
    for (size_t i = 1, e = NumToNode.size(); i != e; 
++i10.0M
) {
599
10.0M
      NodePtr W = NumToNode[i];
600
10.0M
      LLVM_DEBUG(dbgs() << "\tdiscovered a new reachable node "
601
10.0M
                        << BlockNamePrinter(W) << "\n");
602
10.0M
603
10.0M
      // Don't replace this with 'count', the insertion side effect is important
604
10.0M
      if (DT.DomTreeNodes[W]) 
continue1.50M
; // Haven't calculated this node yet?
605
8.52M
606
8.52M
      NodePtr ImmDom = getIDom(W);
607
8.52M
608
8.52M
      // Get or calculate the node for the immediate dominator.
609
8.52M
      TreeNodePtr IDomNode = getNodeForBlock(ImmDom, DT);
610
8.52M
611
8.52M
      // Add a new tree node for this BasicBlock, and link it as a child of
612
8.52M
      // IDomNode.
613
8.52M
      DT.DomTreeNodes[W] = IDomNode->addChild(
614
8.52M
          llvm::make_unique<DomTreeNodeBase<NodeT>>(W, IDomNode));
615
8.52M
    }
616
1.50M
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::attachNewSubtree(llvm::DominatorTreeBase<llvm::BasicBlock, false>&, llvm::DomTreeNodeBase<llvm::BasicBlock>*)
Line
Count
Source
594
10.5M
  void attachNewSubtree(DomTreeT& DT, const TreeNodePtr AttachTo) {
595
10.5M
    // Attach the first unreachable block to AttachTo.
596
10.5M
    NodeToInfo[NumToNode[1]].IDom = AttachTo->getBlock();
597
10.5M
    // Loop over all of the discovered blocks in the function...
598
74.7M
    for (size_t i = 1, e = NumToNode.size(); i != e; 
++i64.2M
) {
599
64.2M
      NodePtr W = NumToNode[i];
600
64.2M
      LLVM_DEBUG(dbgs() << "\tdiscovered a new reachable node "
601
64.2M
                        << BlockNamePrinter(W) << "\n");
602
64.2M
603
64.2M
      // Don't replace this with 'count', the insertion side effect is important
604
64.2M
      if (DT.DomTreeNodes[W]) 
continue10.3M
; // Haven't calculated this node yet?
605
53.8M
606
53.8M
      NodePtr ImmDom = getIDom(W);
607
53.8M
608
53.8M
      // Get or calculate the node for the immediate dominator.
609
53.8M
      TreeNodePtr IDomNode = getNodeForBlock(ImmDom, DT);
610
53.8M
611
53.8M
      // Add a new tree node for this BasicBlock, and link it as a child of
612
53.8M
      // IDomNode.
613
53.8M
      DT.DomTreeNodes[W] = IDomNode->addChild(
614
53.8M
          llvm::make_unique<DomTreeNodeBase<NodeT>>(W, IDomNode));
615
53.8M
    }
616
10.5M
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::attachNewSubtree(llvm::DominatorTreeBase<llvm::BasicBlock, true>&, llvm::DomTreeNodeBase<llvm::BasicBlock>*)
Line
Count
Source
594
605k
  void attachNewSubtree(DomTreeT& DT, const TreeNodePtr AttachTo) {
595
605k
    // Attach the first unreachable block to AttachTo.
596
605k
    NodeToInfo[NumToNode[1]].IDom = AttachTo->getBlock();
597
605k
    // Loop over all of the discovered blocks in the function...
598
4.27M
    for (size_t i = 1, e = NumToNode.size(); i != e; 
++i3.66M
) {
599
3.66M
      NodePtr W = NumToNode[i];
600
3.66M
      LLVM_DEBUG(dbgs() << "\tdiscovered a new reachable node "
601
3.66M
                        << BlockNamePrinter(W) << "\n");
602
3.66M
603
3.66M
      // Don't replace this with 'count', the insertion side effect is important
604
3.66M
      if (DT.DomTreeNodes[W]) 
continue605k
; // Haven't calculated this node yet?
605
3.06M
606
3.06M
      NodePtr ImmDom = getIDom(W);
607
3.06M
608
3.06M
      // Get or calculate the node for the immediate dominator.
609
3.06M
      TreeNodePtr IDomNode = getNodeForBlock(ImmDom, DT);
610
3.06M
611
3.06M
      // Add a new tree node for this BasicBlock, and link it as a child of
612
3.06M
      // IDomNode.
613
3.06M
      DT.DomTreeNodes[W] = IDomNode->addChild(
614
3.06M
          llvm::make_unique<DomTreeNodeBase<NodeT>>(W, IDomNode));
615
3.06M
    }
616
605k
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::attachNewSubtree(llvm::DominatorTreeBase<llvm::VPBlockBase, false>&, llvm::DomTreeNodeBase<llvm::VPBlockBase>*)
Line
Count
Source
594
28
  void attachNewSubtree(DomTreeT& DT, const TreeNodePtr AttachTo) {
595
28
    // Attach the first unreachable block to AttachTo.
596
28
    NodeToInfo[NumToNode[1]].IDom = AttachTo->getBlock();
597
28
    // Loop over all of the discovered blocks in the function...
598
163
    for (size_t i = 1, e = NumToNode.size(); i != e; 
++i135
) {
599
135
      NodePtr W = NumToNode[i];
600
135
      LLVM_DEBUG(dbgs() << "\tdiscovered a new reachable node "
601
135
                        << BlockNamePrinter(W) << "\n");
602
135
603
135
      // Don't replace this with 'count', the insertion side effect is important
604
135
      if (DT.DomTreeNodes[W]) 
continue28
; // Haven't calculated this node yet?
605
107
606
107
      NodePtr ImmDom = getIDom(W);
607
107
608
107
      // Get or calculate the node for the immediate dominator.
609
107
      TreeNodePtr IDomNode = getNodeForBlock(ImmDom, DT);
610
107
611
107
      // Add a new tree node for this BasicBlock, and link it as a child of
612
107
      // IDomNode.
613
107
      DT.DomTreeNodes[W] = IDomNode->addChild(
614
107
          llvm::make_unique<DomTreeNodeBase<NodeT>>(W, IDomNode));
615
107
    }
616
28
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, false> >::attachNewSubtree(llvm::DominatorTreeBase<clang::CFGBlock, false>&, llvm::DomTreeNodeBase<clang::CFGBlock>*)
Line
Count
Source
594
8
  void attachNewSubtree(DomTreeT& DT, const TreeNodePtr AttachTo) {
595
8
    // Attach the first unreachable block to AttachTo.
596
8
    NodeToInfo[NumToNode[1]].IDom = AttachTo->getBlock();
597
8
    // Loop over all of the discovered blocks in the function...
598
74
    for (size_t i = 1, e = NumToNode.size(); i != e; 
++i66
) {
599
66
      NodePtr W = NumToNode[i];
600
66
      LLVM_DEBUG(dbgs() << "\tdiscovered a new reachable node "
601
66
                        << BlockNamePrinter(W) << "\n");
602
66
603
66
      // Don't replace this with 'count', the insertion side effect is important
604
66
      if (DT.DomTreeNodes[W]) 
continue8
; // Haven't calculated this node yet?
605
58
606
58
      NodePtr ImmDom = getIDom(W);
607
58
608
58
      // Get or calculate the node for the immediate dominator.
609
58
      TreeNodePtr IDomNode = getNodeForBlock(ImmDom, DT);
610
58
611
58
      // Add a new tree node for this BasicBlock, and link it as a child of
612
58
      // IDomNode.
613
58
      DT.DomTreeNodes[W] = IDomNode->addChild(
614
58
          llvm::make_unique<DomTreeNodeBase<NodeT>>(W, IDomNode));
615
58
    }
616
8
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<clang::CFGBlock, true> >::attachNewSubtree(llvm::DominatorTreeBase<clang::CFGBlock, true>&, llvm::DomTreeNodeBase<clang::CFGBlock>*)
Line
Count
Source
594
107
  void attachNewSubtree(DomTreeT& DT, const TreeNodePtr AttachTo) {
595
107
    // Attach the first unreachable block to AttachTo.
596
107
    NodeToInfo[NumToNode[1]].IDom = AttachTo->getBlock();
597
107
    // Loop over all of the discovered blocks in the function...
598
763
    for (size_t i = 1, e = NumToNode.size(); i != e; 
++i656
) {
599
656
      NodePtr W = NumToNode[i];
600
656
      LLVM_DEBUG(dbgs() << "\tdiscovered a new reachable node "
601
656
                        << BlockNamePrinter(W) << "\n");
602
656
603
656
      // Don't replace this with 'count', the insertion side effect is important
604
656
      if (DT.DomTreeNodes[W]) 
continue107
; // Haven't calculated this node yet?
605
549
606
549
      NodePtr ImmDom = getIDom(W);
607
549
608
549
      // Get or calculate the node for the immediate dominator.
609
549
      TreeNodePtr IDomNode = getNodeForBlock(ImmDom, DT);
610
549
611
549
      // Add a new tree node for this BasicBlock, and link it as a child of
612
549
      // IDomNode.
613
549
      DT.DomTreeNodes[W] = IDomNode->addChild(
614
549
          llvm::make_unique<DomTreeNodeBase<NodeT>>(W, IDomNode));
615
549
    }
616
107
  }
617
618
423k
  void reattachExistingSubtree(DomTreeT &DT, const TreeNodePtr AttachTo) {
619
423k
    NodeToInfo[NumToNode[1]].IDom = AttachTo->getBlock();
620
14.0M
    for (size_t i = 1, e = NumToNode.size(); i != e; 
++i13.5M
) {
621
13.5M
      const NodePtr N = NumToNode[i];
622
13.5M
      const TreeNodePtr TN = DT.getNode(N);
623
13.5M
      assert(TN);
624
13.5M
      const TreeNodePtr NewIDom = DT.getNode(NodeToInfo[N].IDom);
625
13.5M
      TN->setIDom(NewIDom);
626
13.5M
    }
627
423k
  }
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::reattachExistingSubtree(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false>&, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*)
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::reattachExistingSubtree(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true>&, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*)
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::reattachExistingSubtree(llvm::DominatorTreeBase<llvm::BasicBlock, false>&, llvm::DomTreeNodeBase<llvm::BasicBlock>*)
Line
Count
Source
618
423k
  void reattachExistingSubtree(DomTreeT &DT, const TreeNodePtr AttachTo) {
619
423k
    NodeToInfo[NumToNode[1]].IDom = AttachTo->getBlock();
620
14.0M
    for (size_t i = 1, e = NumToNode.size(); i != e; 
++i13.5M
) {
621
13.5M
      const NodePtr N = NumToNode[i];
622
13.5M
      const TreeNodePtr TN = DT.getNode(N);
623
13.5M
      assert(TN);
624
13.5M
      const TreeNodePtr NewIDom = DT.getNode(NodeToInfo[N].IDom);
625
13.5M
      TN->setIDom(NewIDom);
626
13.5M
    }
627
423k
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::reattachExistingSubtree(llvm::DominatorTreeBase<llvm::BasicBlock, true>&, llvm::DomTreeNodeBase<llvm::BasicBlock>*)
Line
Count
Source
618
93
  void reattachExistingSubtree(DomTreeT &DT, const TreeNodePtr AttachTo) {
619
93
    NodeToInfo[NumToNode[1]].IDom = AttachTo->getBlock();
620
465
    for (size_t i = 1, e = NumToNode.size(); i != e; 
++i372
) {
621
372
      const NodePtr N = NumToNode[i];
622
372
      const TreeNodePtr TN = DT.getNode(N);
623
372
      assert(TN);
624
372
      const TreeNodePtr NewIDom = DT.getNode(NodeToInfo[N].IDom);
625
372
      TN->setIDom(NewIDom);
626
372
    }
627
93
  }
628
629
  // Helper struct used during edge insertions.
630
  struct InsertionInfo {
631
    struct Compare {
632
855
      bool operator()(TreeNodePtr LHS, TreeNodePtr RHS) const {
633
855
        return LHS->getLevel() < RHS->getLevel();
634
855
      }
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::InsertionInfo::Compare::operator()(llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*) const
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::InsertionInfo::Compare::operator()(llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*) const
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::InsertionInfo::Compare::operator()(llvm::DomTreeNodeBase<llvm::BasicBlock>*, llvm::DomTreeNodeBase<llvm::BasicBlock>*) const
Line
Count
Source
632
854
      bool operator()(TreeNodePtr LHS, TreeNodePtr RHS) const {
633
854
        return LHS->getLevel() < RHS->getLevel();
634
854
      }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::InsertionInfo::Compare::operator()(llvm::DomTreeNodeBase<llvm::BasicBlock>*, llvm::DomTreeNodeBase<llvm::BasicBlock>*) const
Line
Count
Source
632
1
      bool operator()(TreeNodePtr LHS, TreeNodePtr RHS) const {
633
1
        return LHS->getLevel() < RHS->getLevel();
634
1
      }
635
    };
636
637
    // Bucket queue of tree nodes ordered by descending level. For simplicity,
638
    // we use a priority_queue here.
639
    std::priority_queue<TreeNodePtr, SmallVector<TreeNodePtr, 8>,
640
                        Compare>
641
        Bucket;
642
    SmallDenseSet<TreeNodePtr, 8> Visited;
643
    SmallVector<TreeNodePtr, 8> Affected;
644
#ifndef NDEBUG
645
    SmallVector<TreeNodePtr, 8> VisitedUnaffected;
646
#endif
647
  };
648
649
  static void InsertEdge(DomTreeT &DT, const BatchUpdatePtr BUI,
650
619k
                         const NodePtr From, const NodePtr To) {
651
619k
    assert((From || IsPostDom) &&
652
619k
           "From has to be a valid CFG node or a virtual root");
653
619k
    assert(To && "Cannot be a nullptr");
654
619k
    LLVM_DEBUG(dbgs() << "Inserting edge " << BlockNamePrinter(From) << " -> "
655
619k
                      << BlockNamePrinter(To) << "\n");
656
619k
    TreeNodePtr FromTN = DT.getNode(From);
657
619k
658
619k
    if (!FromTN) {
659
11.3k
      // Ignore edges from unreachable nodes for (forward) dominators.
660
11.3k
      if (!IsPostDom) 
return11.3k
;
661
3
662
3
      // The unreachable node becomes a new root -- a tree node for it.
663
3
      TreeNodePtr VirtualRoot = DT.getNode(nullptr);
664
3
      FromTN =
665
3
          (DT.DomTreeNodes[From] = VirtualRoot->addChild(
666
3
               llvm::make_unique<DomTreeNodeBase<NodeT>>(From, VirtualRoot)))
667
3
              .get();
668
3
      DT.Roots.push_back(From);
669
3
    }
670
619k
671
619k
    DT.DFSInfoValid = false;
672
608k
673
608k
    const TreeNodePtr ToTN = DT.getNode(To);
674
608k
    if (!ToTN)
675
114k
      InsertUnreachable(DT, BUI, FromTN, To);
676
493k
    else
677
493k
      InsertReachable(DT, BUI, FromTN, ToTN);
678
608k
  }
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::InsertEdge(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::BatchUpdateInfo*, llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::InsertEdge(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::BatchUpdateInfo*, llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::InsertEdge(llvm::DominatorTreeBase<llvm::BasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::BatchUpdateInfo*, llvm::BasicBlock*, llvm::BasicBlock*)
Line
Count
Source
650
619k
                         const NodePtr From, const NodePtr To) {
651
619k
    assert((From || IsPostDom) &&
652
619k
           "From has to be a valid CFG node or a virtual root");
653
619k
    assert(To && "Cannot be a nullptr");
654
619k
    LLVM_DEBUG(dbgs() << "Inserting edge " << BlockNamePrinter(From) << " -> "
655
619k
                      << BlockNamePrinter(To) << "\n");
656
619k
    TreeNodePtr FromTN = DT.getNode(From);
657
619k
658
619k
    if (!FromTN) {
659
11.3k
      // Ignore edges from unreachable nodes for (forward) dominators.
660
11.3k
      if (!IsPostDom) return;
661
0
662
0
      // The unreachable node becomes a new root -- a tree node for it.
663
0
      TreeNodePtr VirtualRoot = DT.getNode(nullptr);
664
0
      FromTN =
665
0
          (DT.DomTreeNodes[From] = VirtualRoot->addChild(
666
0
               llvm::make_unique<DomTreeNodeBase<NodeT>>(From, VirtualRoot)))
667
0
              .get();
668
0
      DT.Roots.push_back(From);
669
0
    }
670
619k
671
619k
    DT.DFSInfoValid = false;
672
608k
673
608k
    const TreeNodePtr ToTN = DT.getNode(To);
674
608k
    if (!ToTN)
675
114k
      InsertUnreachable(DT, BUI, FromTN, To);
676
493k
    else
677
493k
      InsertReachable(DT, BUI, FromTN, ToTN);
678
608k
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::InsertEdge(llvm::DominatorTreeBase<llvm::BasicBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::BatchUpdateInfo*, llvm::BasicBlock*, llvm::BasicBlock*)
Line
Count
Source
650
162
                         const NodePtr From, const NodePtr To) {
651
162
    assert((From || IsPostDom) &&
652
162
           "From has to be a valid CFG node or a virtual root");
653
162
    assert(To && "Cannot be a nullptr");
654
162
    LLVM_DEBUG(dbgs() << "Inserting edge " << BlockNamePrinter(From) << " -> "
655
162
                      << BlockNamePrinter(To) << "\n");
656
162
    TreeNodePtr FromTN = DT.getNode(From);
657
162
658
162
    if (!FromTN) {
659
3
      // Ignore edges from unreachable nodes for (forward) dominators.
660
3
      if (!IsPostDom) 
return0
;
661
3
662
3
      // The unreachable node becomes a new root -- a tree node for it.
663
3
      TreeNodePtr VirtualRoot = DT.getNode(nullptr);
664
3
      FromTN =
665
3
          (DT.DomTreeNodes[From] = VirtualRoot->addChild(
666
3
               llvm::make_unique<DomTreeNodeBase<NodeT>>(From, VirtualRoot)))
667
3
              .get();
668
3
      DT.Roots.push_back(From);
669
3
    }
670
162
671
162
    DT.DFSInfoValid = false;
672
162
673
162
    const TreeNodePtr ToTN = DT.getNode(To);
674
162
    if (!ToTN)
675
3
      InsertUnreachable(DT, BUI, FromTN, To);
676
159
    else
677
159
      InsertReachable(DT, BUI, FromTN, ToTN);
678
162
  }
679
680
  // Determines if some existing root becomes reverse-reachable after the
681
  // insertion. Rebuilds the whole tree if that situation happens.
682
  static bool UpdateRootsBeforeInsertion(DomTreeT &DT, const BatchUpdatePtr BUI,
683
                                         const TreeNodePtr From,
684
230
                                         const TreeNodePtr To) {
685
230
    assert(IsPostDom && "This function is only for postdominators");
686
230
    // Destination node is not attached to the virtual root, so it cannot be a
687
230
    // root.
688
230
    if (!DT.isVirtualRoot(To->getIDom())) 
return false130
;
689
100
690
100
    auto RIt = llvm::find(DT.Roots, To->getBlock());
691
100
    if (RIt == DT.Roots.end())
692
15
      return false;  // To is not a root, nothing to update.
693
85
694
85
    LLVM_DEBUG(dbgs() << "\t\tAfter the insertion, " << BlockNamePrinter(To)
695
85
                      << " is no longer a root\n\t\tRebuilding the tree!!!\n");
696
85
697
85
    CalculateFromScratch(DT, BUI);
698
85
    return true;
699
85
  }
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::UpdateRootsBeforeInsertion(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*)
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::UpdateRootsBeforeInsertion(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*)
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::UpdateRootsBeforeInsertion(llvm::DominatorTreeBase<llvm::BasicBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::BasicBlock>*, llvm::DomTreeNodeBase<llvm::BasicBlock>*)
Line
Count
Source
684
230
                                         const TreeNodePtr To) {
685
230
    assert(IsPostDom && "This function is only for postdominators");
686
230
    // Destination node is not attached to the virtual root, so it cannot be a
687
230
    // root.
688
230
    if (!DT.isVirtualRoot(To->getIDom())) 
return false130
;
689
100
690
100
    auto RIt = llvm::find(DT.Roots, To->getBlock());
691
100
    if (RIt == DT.Roots.end())
692
15
      return false;  // To is not a root, nothing to update.
693
85
694
85
    LLVM_DEBUG(dbgs() << "\t\tAfter the insertion, " << BlockNamePrinter(To)
695
85
                      << " is no longer a root\n\t\tRebuilding the tree!!!\n");
696
85
697
85
    CalculateFromScratch(DT, BUI);
698
85
    return true;
699
85
  }
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::UpdateRootsBeforeInsertion(llvm::DominatorTreeBase<llvm::BasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::BasicBlock>*, llvm::DomTreeNodeBase<llvm::BasicBlock>*)
700
701
  static bool isPermutation(const SmallVectorImpl<NodePtr> &A,
702
782
                            const SmallVectorImpl<NodePtr> &B) {
703
782
    if (A.size() != B.size())
704
11
      return false;
705
771
    SmallPtrSet<NodePtr, 4> Set(A.begin(), A.end());
706
771
    for (NodePtr N : B)
707
1.50k
      if (Set.count(N) == 0)
708
26
        return false;
709
771
    
return true745
;
710
771
  }
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::isPermutation(llvm::SmallVectorImpl<llvm::MachineBasicBlock*> const&, llvm::SmallVectorImpl<llvm::MachineBasicBlock*> const&)
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::isPermutation(llvm::SmallVectorImpl<llvm::MachineBasicBlock*> const&, llvm::SmallVectorImpl<llvm::MachineBasicBlock*> const&)
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::isPermutation(llvm::SmallVectorImpl<llvm::BasicBlock*> const&, llvm::SmallVectorImpl<llvm::BasicBlock*> const&)
Line
Count
Source
702
415
                            const SmallVectorImpl<NodePtr> &B) {
703
415
    if (A.size() != B.size())
704
11
      return false;
705
404
    SmallPtrSet<NodePtr, 4> Set(A.begin(), A.end());
706
404
    for (NodePtr N : B)
707
1.13k
      if (Set.count(N) == 0)
708
26
        return false;
709
404
    
return true378
;
710
404
  }
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::isPermutation(llvm::SmallVectorImpl<llvm::BasicBlock*> const&, llvm::SmallVectorImpl<llvm::BasicBlock*> const&)
Line
Count
Source
702
367
                            const SmallVectorImpl<NodePtr> &B) {
703
367
    if (A.size() != B.size())
704
0
      return false;
705
367
    SmallPtrSet<NodePtr, 4> Set(A.begin(), A.end());
706
367
    for (NodePtr N : B)
707
367
      if (Set.count(N) == 0)
708
0
        return false;
709
367
    return true;
710
367
  }
711
712
  // Updates the set of roots after insertion or deletion. This ensures that
713
  // roots are the same when after a series of updates and when the tree would
714
  // be built from scratch.
715
330
  static void UpdateRootsAfterUpdate(DomTreeT &DT, const BatchUpdatePtr BUI) {
716
330
    assert(IsPostDom && "This function is only for postdominators");
717
330
718
330
    // The tree has only trivial roots -- nothing to update.
719
763
    if (
std::none_of(DT.Roots.begin(), DT.Roots.end(), [BUI](const NodePtr N) 330
{
720
763
          return HasForwardSuccessors(N, BUI);
721
763
        }))
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::UpdateRootsAfterUpdate(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::BatchUpdateInfo*)::'lambda'(llvm::MachineBasicBlock*)::operator()(llvm::MachineBasicBlock*) const
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::UpdateRootsAfterUpdate(llvm::DominatorTreeBase<llvm::BasicBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::BatchUpdateInfo*)::'lambda'(llvm::BasicBlock*)::operator()(llvm::BasicBlock*) const
Line
Count
Source
719
763
    if (std::none_of(DT.Roots.begin(), DT.Roots.end(), [BUI](const NodePtr N) {
720
763
          return HasForwardSuccessors(N, BUI);
721
763
        }))
722
263
      return;
723
67
724
67
    // Recalculate the set of roots.
725
67
    RootsT Roots = FindRoots(DT, BUI);
726
67
    if (!isPermutation(DT.Roots, Roots)) {
727
37
      // The roots chosen in the CFG have changed. This is because the
728
37
      // incremental algorithm does not really know or use the set of roots and
729
37
      // can make a different (implicit) decision about which node within an
730
37
      // infinite loop becomes a root.
731
37
732
37
      LLVM_DEBUG(dbgs() << "Roots are different in updated trees\n"
733
37
                        << "The entire tree needs to be rebuilt\n");
734
37
      // It may be possible to update the tree without recalculating it, but
735
37
      // we do not know yet how to do it, and it happens rarely in practise.
736
37
      CalculateFromScratch(DT, BUI);
737
37
    }
738
67
  }
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::UpdateRootsAfterUpdate(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::BatchUpdateInfo*)
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::UpdateRootsAfterUpdate(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::BatchUpdateInfo*)
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::UpdateRootsAfterUpdate(llvm::DominatorTreeBase<llvm::BasicBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, true> >::BatchUpdateInfo*)
Line
Count
Source
715
330
  static void UpdateRootsAfterUpdate(DomTreeT &DT, const BatchUpdatePtr BUI) {
716
330
    assert(IsPostDom && "This function is only for postdominators");
717
330
718
330
    // The tree has only trivial roots -- nothing to update.
719
330
    if (std::none_of(DT.Roots.begin(), DT.Roots.end(), [BUI](const NodePtr N) {
720
330
          return HasForwardSuccessors(N, BUI);
721
330
        }))
722
263
      return;
723
67
724
67
    // Recalculate the set of roots.
725
67
    RootsT Roots = FindRoots(DT, BUI);
726
67
    if (!isPermutation(DT.Roots, Roots)) {
727
37
      // The roots chosen in the CFG have changed. This is because the
728
37
      // incremental algorithm does not really know or use the set of roots and
729
37
      // can make a different (implicit) decision about which node within an
730
37
      // infinite loop becomes a root.
731
37
732
37
      LLVM_DEBUG(dbgs() << "Roots are different in updated trees\n"
733
37
                        << "The entire tree needs to be rebuilt\n");
734
37
      // It may be possible to update the tree without recalculating it, but
735
37
      // we do not know yet how to do it, and it happens rarely in practise.
736
37
      CalculateFromScratch(DT, BUI);
737
37
    }
738
67
  }
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::UpdateRootsAfterUpdate(llvm::DominatorTreeBase<llvm::BasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::BatchUpdateInfo*)
739
740
  // Handles insertion to a node already in the dominator tree.
741
  static void InsertReachable(DomTreeT &DT, const BatchUpdatePtr BUI,
742
519k
                              const TreeNodePtr From, const TreeNodePtr To) {
743
519k
    LLVM_DEBUG(dbgs() << "\tReachable " << BlockNamePrinter(From->getBlock())
744
519k
                      << " -> " << BlockNamePrinter(To->getBlock()) << "\n");
745
519k
    if (IsPostDom && 
UpdateRootsBeforeInsertion(DT, BUI, From, To)230
)
return85
;
746
519k
    // DT.findNCD expects both pointers to be valid. When From is a virtual
747
519k
    // root, then its CFG block pointer is a nullptr, so we have to 'compute'
748
519k
    // the NCD manually.
749
519k
    const NodePtr NCDBlock =
750
519k
        (From->getBlock() && 
To->getBlock()519k
)
751
519k
            ? 
DT.findNearestCommonDominator(From->getBlock(), To->getBlock())519k
752
519k
            : 
nullptr71
;
753
519k
    assert(NCDBlock || DT.isPostDominator());
754
519k
    const TreeNodePtr NCD = DT.getNode(NCDBlock);
755
519k
    assert(NCD);
756
519k
757
519k
    LLVM_DEBUG(dbgs() << "\t\tNCA == " << BlockNamePrinter(NCD) << "\n");
758
519k
    const unsigned NCDLevel = NCD->getLevel();
759
519k
760
519k
    // Based on Lemma 2.5 from the second paper, after insertion of (From,To), v
761
519k
    // is affected iff depth(NCD)+1 < depth(v) && a path P from To to v exists
762
519k
    // where every w on P s.t. depth(v) <= depth(w)
763
519k
    //
764
519k
    // This reduces to a widest path problem (maximizing the depth of the
765
519k
    // minimum vertex in the path) which can be solved by a modified version of
766
519k
    // Dijkstra with a bucket queue (named depth-based search in the paper).
767
519k
768
519k
    // To is in the path, so depth(NCD)+1 < depth(v) <= depth(To). Nothing
769
519k
    // affected if this does not hold.
770
519k
    if (NCDLevel + 1 >= To->getLevel())
771
189k
      return;
772
329k
773
329k
    InsertionInfo II;
774
329k
    SmallVector<TreeNodePtr, 8> UnaffectedOnCurrentLevel;
775
329k
    II.Bucket.push(To);
776
329k
    II.Visited.insert(To);
777
329k
778
671k
    while (!II.Bucket.empty()) {
779
341k
      TreeNodePtr TN = II.Bucket.top();
780
341k
      II.Bucket.pop();
781
341k
      II.Affected.push_back(TN);
782
341k
783
341k
      const unsigned CurrentLevel = TN->getLevel();
784
341k
      LLVM_DEBUG(dbgs() << "Mark " << BlockNamePrinter(TN) <<
785
341k
                 "as affected, CurrentLevel " << CurrentLevel << "\n");
786
341k
787
341k
      assert(TN->getBlock() && II.Visited.count(TN) && "Preconditions!");
788
341k
789
9.43M
      while (true) {
790
9.43M
        // Unlike regular Dijkstra, we have an inner loop to expand more
791
9.43M
        // vertices. The first iteration is for the (affected) vertex popped
792
9.43M
        // from II.Bucket and the rest are for vertices in
793
9.43M
        // UnaffectedOnCurrentLevel, which may eventually expand to affected
794
9.43M
        // vertices.
795
9.43M
        //
796
9.43M
        // Invariant: there is an optimal path from `To` to TN with the minimum
797
9.43M
        // depth being CurrentLevel.
798
9.43M
        for (const NodePtr Succ :
799
10.4M
             ChildrenGetter<IsPostDom>::Get(TN->getBlock(), BUI)) {
800
10.4M
          const TreeNodePtr SuccTN = DT.getNode(Succ);
801
10.4M
          assert(SuccTN &&
802
10.4M
                 "Unreachable successor found at reachable insertion");
803
10.4M
          const unsigned SuccLevel = SuccTN->getLevel();
804
10.4M
805
10.4M
          LLVM_DEBUG(dbgs() << "\tSuccessor " << BlockNamePrinter(Succ)
806
10.4M
                            << ", level = " << SuccLevel << "\n");
807
10.4M
808
10.4M
          // There is an optimal path from `To` to Succ with the minimum depth
809
10.4M
          // being min(CurrentLevel, SuccLevel).
810
10.4M
          //
811
10.4M
          // If depth(NCD)+1 < depth(Succ) is not satisfied, Succ is unaffected
812
10.4M
          // and no affected vertex may be reached by a path passing through it.
813
10.4M
          // Stop here. Also, Succ may be visited by other predecessors but the
814
10.4M
          // first visit has the optimal path. Stop if Succ has been visited.
815
10.4M
          if (SuccLevel <= NCDLevel + 1 || 
!II.Visited.insert(SuccTN).second9.99M
)
816
1.34M
            continue;
817
9.10M
818
9.10M
          if (SuccLevel > CurrentLevel) {
819
9.09M
            // Succ is unaffected but it may (transitively) expand to affected
820
9.09M
            // vertices. Store it in UnaffectedOnCurrentLevel.
821
9.09M
            LLVM_DEBUG(dbgs() << "\t\tMarking visited not affected "
822
9.09M
                              << BlockNamePrinter(Succ) << "\n");
823
9.09M
            UnaffectedOnCurrentLevel.push_back(SuccTN);
824
#ifndef NDEBUG
825
            II.VisitedUnaffected.push_back(SuccTN);
826
#endif
827
11.5k
          } else {
828
11.5k
            // The condition is satisfied (Succ is affected). Add Succ to the
829
11.5k
            // bucket queue.
830
11.5k
            LLVM_DEBUG(dbgs() << "\t\tAdd " << BlockNamePrinter(Succ)
831
11.5k
                              << " to a Bucket\n");
832
11.5k
            II.Bucket.push(SuccTN);
833
11.5k
          }
834
9.10M
        }
835
9.43M
836
9.43M
        if (UnaffectedOnCurrentLevel.empty())
837
341k
          break;
838
9.09M
        TN = UnaffectedOnCurrentLevel.pop_back_val();
839
9.09M
        LLVM_DEBUG(dbgs() << " Next: " << BlockNamePrinter(TN) << "\n");
840
9.09M
      }
841
341k
    }
842
329k
843
329k
    // Finish by updating immediate dominators and levels.
844
329k
    UpdateInsertion(DT, BUI, NCD, II);
845
329k
  }
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::InsertReachable(llvm::DominatorTreeBase<llvm::MachineBasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, false> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*)
Unexecuted instantiation: llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::InsertReachable(llvm::DominatorTreeBase<llvm::MachineBasicBlock, true>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::MachineBasicBlock, true> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*, llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*)
llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::InsertReachable(llvm::DominatorTreeBase<llvm::BasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::BatchUpdateInfo*, llvm::DomTreeNodeBase<llvm::BasicBlock>*, llvm::DomTreeNodeBase<llvm::BasicBlock>*)
Line
Count
Source
742
519k
                              const TreeNodePtr From, const TreeNodePtr To) {