diff options
| author | River Riddle <riverriddle@google.com> | 2019-09-18 18:23:12 -0700 |
|---|---|---|
| committer | A. Unique TensorFlower <gardener@tensorflow.org> | 2019-09-18 18:23:41 -0700 |
| commit | 35df51086aefa1420784a096fd406febadae315a (patch) | |
| tree | 13523369bb0d483e9f23c18d87c9f681f4ca7a91 /mlir/lib/Analysis | |
| parent | 727a50ae2db4492a8c3168647996abacd75d0622 (diff) | |
| download | bcm5719-llvm-35df51086aefa1420784a096fd406febadae315a.tar.gz bcm5719-llvm-35df51086aefa1420784a096fd406febadae315a.zip | |
Fix nested dominance relationship between parent results and child operations.
This modifies DominanceInfo::properlyDominates(Value *value, Operation *op) to return false if the value is defined by a parent operation of 'op'. This prevents using values defined by the parent operation from within any child regions.
PiperOrigin-RevId: 269934920
Diffstat (limited to 'mlir/lib/Analysis')
| -rw-r--r-- | mlir/lib/Analysis/Dominance.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/mlir/lib/Analysis/Dominance.cpp b/mlir/lib/Analysis/Dominance.cpp index ead8d7e070c..71caa3eec42 100644 --- a/mlir/lib/Analysis/Dominance.cpp +++ b/mlir/lib/Analysis/Dominance.cpp @@ -128,8 +128,14 @@ bool DominanceInfo::properlyDominates(Operation *a, Operation *b) { /// Return true if value A properly dominates operation B. bool DominanceInfo::properlyDominates(Value *a, Operation *b) { - if (auto *aInst = a->getDefiningOp()) + if (auto *aInst = a->getDefiningOp()) { + // The values defined by an operation do *not* dominate any nested + // operations. + if (aInst->getParentRegion() != b->getParentRegion() && + aInst->isAncestor(b)) + return false; return properlyDominates(aInst, b); + } // block arguments properly dominate all operations in their own block, so // we use a dominates check here, not a properlyDominates check. |

