Skip to content

Commit 5f5134c

Browse files
authored
Merge pull request #28032 from atrick/cleanup-dyncast
SILCombine cleanup; replace null check with dyn_cast_or_null.
2 parents 4e106fb + fd6497b commit 5f5134c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/SILOptimizer/SILCombiner/SILCombinerApplyVisitors.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -907,8 +907,8 @@ SILCombiner::buildConcreteOpenedExistentialInfoFromSoleConformingType(
907907
(archetypeTy->getConformsTo().size() == 1)) {
908908
PD = archetypeTy->getConformsTo()[0];
909909
} else if (ArgType.isExistentialType() && !ArgType.isAnyObject() &&
910-
!SwiftArgType->isAny() && SwiftArgType->getAnyNominal()) {
911-
PD = dyn_cast<ProtocolDecl>(SwiftArgType->getAnyNominal());
910+
!SwiftArgType->isAny()) {
911+
PD = dyn_cast_or_null<ProtocolDecl>(SwiftArgType->getAnyNominal());
912912
}
913913
}
914914

validation-test/compiler_crashers_2_fixed/sr11624.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// See https://swift.org/LICENSE.txt for license information
66
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
77

8-
// RUN: not %target-swift-frontend %s -O -whole-module-optimization
8+
// RUN: %target-swift-frontend %s -O -whole-module-optimization -emit-sil
99

1010
class ClassA<T> { }
1111
protocol ProtocolA { }

0 commit comments

Comments
 (0)