Files
swift-mirror/test/SILOptimizer/simplify_cond_fail.sil
2023-05-08 21:23:36 +02:00

40 lines
1013 B
Plaintext

// RUN: %target-sil-opt -enable-sil-verify-all %s -onone-simplification -simplify-instruction=cond_fail | %FileCheck %s
// REQUIRES: swift_in_compiler
import Swift
import Builtin
// CHECK-LABEL: sil @not_failing
// CHECK-NOT: cond_fail
// CHECK: } // end sil function 'not_failing'
sil @not_failing : $@convention(thin) () -> () {
bb0:
%0 = integer_literal $Builtin.Int1, 0
cond_fail %0 : $Builtin.Int1, "not failing"
%r = tuple ()
return %r : $()
}
// CHECK-LABEL: sil @failing
// CHECK: cond_fail
// CHECK: } // end sil function 'failing'
sil @failing : $@convention(thin) () -> () {
bb0:
%0 = integer_literal $Builtin.Int1, -1
cond_fail %0 : $Builtin.Int1, "failing"
%r = tuple ()
return %r : $()
}
// CHECK-LABEL: sil @unknown
// CHECK: cond_fail
// CHECK: } // end sil function 'unknown'
sil @unknown : $@convention(thin) (Builtin.Int1) -> () {
bb0(%0 : $Builtin.Int1):
cond_fail %0 : $Builtin.Int1, "unknown"
%r = tuple ()
return %r : $()
}