Skip to content

Commit 86b812b

Browse files
authored
Merge pull request #63033 from nate-chandler/opaque-values/2/20221215
[AddressLowering] Project at storage.
2 parents fa17a05 + a27b390 commit 86b812b

File tree

7 files changed

+767
-183
lines changed

7 files changed

+767
-183
lines changed

include/swift/SIL/Dominance.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ class DominanceInfo : public DominatorTreeBase {
6161
/// Does value A properly dominate instruction B?
6262
bool properlyDominates(SILValue a, SILInstruction *b);
6363

64+
/// The nearest block which dominates all the uses of \p value.
65+
SILBasicBlock *getLeastCommonAncestorOfUses(SILValue value);
66+
6467
void verify() const;
6568

6669
/// Return true if the other dominator tree does not match this dominator

lib/SIL/Utils/Dominance.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,15 @@ bool DominanceInfo::properlyDominates(SILValue a, SILInstruction *b) {
7373
return false;
7474
}
7575

76+
SILBasicBlock *DominanceInfo::getLeastCommonAncestorOfUses(SILValue value) {
77+
SILBasicBlock *lca = nullptr;
78+
for (auto *use : value->getUses()) {
79+
auto *block = use->getParentBlock();
80+
lca = lca ? findNearestCommonDominator(lca, block) : block;
81+
}
82+
return lca;
83+
}
84+
7685
void DominanceInfo::verify() const {
7786
// Recompute.
7887
auto *F = getRoot()->getParent();

0 commit comments

Comments
 (0)