Files
swift-mirror/test/SILOptimizer/simplify_explicit_copy_value.sil
Erik Eckstein 844217d58c Optimizer: replace explicit_copy_value and explicit_copy_addr with their non-explicit counterparts
The `explicit_copy_value` and `explicit_copy_addr` instructions are only used for non-copyable diagnostics in the mandatory pipeline.
After that we can replace them by their non-explicit counterparts so that optimizations (which only know of `copy_value` and `copy_addr`) can do their work.

rdar://159039552
2025-09-04 19:40:53 +02:00

22 lines
846 B
Plaintext

// RUN: %target-sil-opt -enable-sil-verify-all %s -onone-simplification -simplify-instruction=explicit_copy_value | %FileCheck %s --check-prefix=CHECK-ONONE --check-prefix=CHECK
// RUN: %target-sil-opt -enable-sil-verify-all %s -simplification -simplify-instruction=explicit_copy_value | %FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK
// REQUIRES: swift_in_compiler
sil_stage canonical
import Swift
import Builtin
// CHECK-LABEL: sil [ossa] @simplify_explicit_copy_value :
// CHECK-O: %1 = copy_value %0
// CHECK-ONONE: %1 = explicit_copy_value %0
// CHECK-NEXT: return %1
// CHECK: } // end sil function 'simplify_explicit_copy_value'
sil [ossa] @simplify_explicit_copy_value : $@convention(thin) (@guaranteed String) -> @owned String {
bb0(%0 : @guaranteed $String):
%1 = explicit_copy_value %0
return %1
}