Skip to content

Commit 131bee7

Browse files
authored
Merge pull request #25515 from dcci/amend-and-amend
2 parents 6370681 + 12ee5d3 commit 131bee7

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

lib/SILOptimizer/Utils/CastOptimizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1572,7 +1572,7 @@ static bool optimizeStaticallyKnownProtocolConformance(
15721572
if (!Conformance)
15731573
return false;
15741574

1575-
SILBuilder B(Inst);
1575+
SILBuilderWithScope B(Inst);
15761576
SmallVector<ProtocolConformanceRef, 1> NewConformances;
15771577
NewConformances.push_back(Conformance.getValue());
15781578
ArrayRef<ProtocolConformanceRef> Conformances =
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// REQUIRES: optimized_stdlib
2+
3+
// RUN: %target-swift-frontend -emit-sil -o /dev/null \
4+
// RUN: %s -Xllvm -sil-print-debuginfo -Onone -sil-verify-all \
5+
// RUN: -Xllvm -sil-print-after=diagnostic-constant-propagation \
6+
// RUN: 2>&1 | %FileCheck %s
7+
8+
// CHECK: alloc_stack $R, loc {{.*}}, scope 2
9+
// CHECK-NEXT: init_existential_addr {{.*}} : $*R, $Float, loc {{.*}}, scope 2
10+
// CHECK-NEXT: copy_addr [take] %8 to [initialization] %66 : $*Float, loc {{.*}}, scope 2
11+
12+
protocol R {}
13+
extension Float: R {}
14+
print(1.0 as Float? as! R)

0 commit comments

Comments
 (0)