mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
SIL: Update formal source type in SimplifyRefCasts when possible
We use the formal source type do decide whether a checked_cast_br is known to succeed/fail. If we don't update it we loose that optimization That is: ``` checked_cast_br AnyObject in %2 : X to X, bb1, bb2 ``` Will not be simplified even though the operand and the destintation type matches.
This commit is contained in:
@@ -11,7 +11,7 @@ class X : B {}
|
||||
|
||||
// CHECK-LABEL: sil [ossa] @test_ossa :
|
||||
// CHECK: %0 = alloc_ref
|
||||
// CHECK-NEXT: checked_cast_br AnyObject in %0 : $X
|
||||
// CHECK-NEXT: checked_cast_br X in %0 : $X
|
||||
// CHECK: bb2([[A:%.*]] : @owned $X):
|
||||
// CHECK-NEXT: [[U:%.*]] = upcast [[A]] : $X to $B, loc "takethis":1:1
|
||||
// CHECK-NEXT: [[E:%.*]] = init_existential_ref [[U]] {{.+}}, loc "takethis":1:1
|
||||
|
||||
Reference in New Issue
Block a user