Skip to content

Commit 9575a6e

Browse files
author
Davide Italiano
committed
[CastOptimizer] Set the correct debug scope for the SILBuilder.
<rdar://problem/48887384>
1 parent a03cb96 commit 9575a6e

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lib/SILOptimizer/Utils/CastOptimizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1532,7 +1532,7 @@ static bool optimizeStaticallyKnownProtocolConformance(
15321532
if (!Conformance)
15331533
return false;
15341534

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

0 commit comments

Comments
 (0)