forked from OSchip/llvm-project
Add a pair of hooks to DominanceInfo.
This exposes hooks for accessing internal dominance nodes, and updating the internal DFS numbers. Closes tensorflow/mlir#151 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/151 from schweitzpgi:dominance_hooks 69d14214a423b816cbd59feffcacdd02f3b5f921 PiperOrigin-RevId: 272287352
This commit is contained in:
parent
c760f233b3
commit
9e6dde3977
|
@ -90,6 +90,12 @@ public:
|
|||
bool properlyDominates(Block *a, Block *b) {
|
||||
return super::properlyDominates(a, b);
|
||||
}
|
||||
|
||||
/// Return the dominance node from the Region containing block A.
|
||||
DominanceInfoNode *getNode(Block *a);
|
||||
|
||||
/// Update the internal DFS numbers for the dominance nodes.
|
||||
void updateDFSNumbers();
|
||||
};
|
||||
|
||||
/// A class for computing basic postdominance information.
|
||||
|
|
|
@ -142,6 +142,17 @@ bool DominanceInfo::properlyDominates(Value *a, Operation *b) {
|
|||
return dominates(cast<BlockArgument>(a)->getOwner(), b->getBlock());
|
||||
}
|
||||
|
||||
DominanceInfoNode *DominanceInfo::getNode(Block *a) {
|
||||
auto *region = a->getParent();
|
||||
assert(dominanceInfos.count(region) != 0);
|
||||
return dominanceInfos[region]->getNode(a);
|
||||
}
|
||||
|
||||
void DominanceInfo::updateDFSNumbers() {
|
||||
for (auto &iter : dominanceInfos)
|
||||
iter.second->updateDFSNumbers();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// PostDominanceInfo
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
Loading…
Reference in New Issue