Skip to content

Commit 0af1802

Browse files
committed
Merge remote-tracking branch 'origin/master' into master-next
2 parents 2ce27b6 + c787ec3 commit 0af1802

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

lib/SILOptimizer/Mandatory/PredictableMemOpt.cpp

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,24 @@ static unsigned getNumSubElements(SILType T, SILModule &M) {
6565

6666
/// getAccessPathRoot - Given an address, dive through any tuple/struct element
6767
/// addresses to get the underlying value.
68-
static SILValue getAccessPathRoot(SILValue Pointer) {
69-
while (1) {
70-
if (auto *TEAI = dyn_cast<TupleElementAddrInst>(Pointer))
71-
Pointer = TEAI->getOperand();
72-
else if (auto SEAI = dyn_cast<StructElementAddrInst>(Pointer))
73-
Pointer = SEAI->getOperand();
74-
else if (auto BAI = dyn_cast<BeginAccessInst>(Pointer))
75-
Pointer = BAI->getSource();
76-
else
77-
return Pointer;
68+
static SILValue getAccessPathRoot(SILValue pointer) {
69+
while (true) {
70+
if (auto *TEAI = dyn_cast<TupleElementAddrInst>(pointer)) {
71+
pointer = TEAI->getOperand();
72+
continue;
73+
}
74+
75+
if (auto *SEAI = dyn_cast<StructElementAddrInst>(pointer)) {
76+
pointer = SEAI->getOperand();
77+
continue;
78+
}
79+
80+
if (auto *BAI = dyn_cast<BeginAccessInst>(pointer)) {
81+
pointer = BAI->getSource();
82+
continue;
83+
}
84+
85+
return pointer;
7886
}
7987
}
8088

0 commit comments

Comments
 (0)