Skip to content

Commit 37d8586

Browse files
committed
Update SILSSAUpdater::areIdentical to check for SILArgument
1 parent 56629e1 commit 37d8586

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

lib/SILOptimizer/Utils/SILSSAUpdater.cpp

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,30 @@ areIdentical(llvm::DenseMap<SILBasicBlock *, SILValue> &availableValues) {
8686
return true;
8787
}
8888

89-
auto *mvir =
90-
dyn_cast<MultipleValueInstructionResult>(availableValues.begin()->second);
91-
if (!mvir)
92-
return false;
89+
if (auto *mvir = dyn_cast<MultipleValueInstructionResult>(
90+
availableValues.begin()->second)) {
91+
for (auto value : availableValues) {
92+
auto *result = dyn_cast<MultipleValueInstructionResult>(value.second);
93+
if (!result)
94+
return false;
95+
if (!result->getParent()->isIdenticalTo(mvir->getParent()) ||
96+
result->getIndex() != mvir->getIndex()) {
97+
return false;
98+
}
99+
}
100+
return true;
101+
}
93102

103+
auto *firstArg = cast<SILArgument>(availableValues.begin()->second);
94104
for (auto value : availableValues) {
95-
auto *result = dyn_cast<MultipleValueInstructionResult>(value.second);
96-
if (!result)
105+
auto *arg = dyn_cast<SILArgument>(value.second);
106+
if (!arg)
97107
return false;
98-
if (!result->getParent()->isIdenticalTo(mvir->getParent()) ||
99-
result->getIndex() != mvir->getIndex()) {
108+
if (arg != firstArg) {
100109
return false;
101110
}
102111
}
112+
103113
return true;
104114
}
105115

0 commit comments

Comments
 (0)