|
1 |
| -// RUN: %target-sil-opt -loop-rotate -update-borrowed-from -looprotate-single-block-loop=true %s | %FileCheck %s |
| 1 | +// RUN: %target-sil-opt -loop-rotate -update-borrowed-from -looprotate-single-block-loop=true -looprotate-infinite-budget %s | %FileCheck %s |
2 | 2 | sil_stage canonical
|
3 | 3 |
|
4 | 4 | import Builtin
|
5 | 5 | import Swift
|
6 | 6 |
|
7 | 7 | class Klass {
|
8 |
| - |
9 | 8 | }
|
10 | 9 |
|
11 | 10 | struct BoxStruct {
|
@@ -244,3 +243,41 @@ bb8:
|
244 | 243 | bb9:
|
245 | 244 | unreachable
|
246 | 245 | }
|
| 246 | + |
| 247 | +// Ensure no verifier error |
| 248 | + |
| 249 | +sil @foo : $@convention(thin) (@in_guaranteed UInt64, @in_guaranteed UInt64) -> (Bool, @error any Error) |
| 250 | + |
| 251 | +sil [ossa] @looprotate_ownership_results : $@convention(thin) (Int32, @guaranteed Klass) -> Int32 { |
| 252 | +bb0(%0 : $Int32, %1 : @guaranteed $Klass): |
| 253 | + %2 = struct_extract %0, #Int32._value |
| 254 | + %3 = integer_literal $Builtin.Int32, 0 |
| 255 | + br bb1(%2, %3) |
| 256 | + |
| 257 | +bb1(%5 : $Builtin.Int32, %6 : $Builtin.Int32): |
| 258 | + %7 = function_ref @foo : $@convention(thin) (@in_guaranteed UInt64, @in_guaranteed UInt64) -> (Bool, @error any Error) |
| 259 | + %8 = thin_to_thick_function %7 to $@noescape @callee_guaranteed (@in_guaranteed UInt64, @in_guaranteed UInt64) -> (Bool, @error any Error) |
| 260 | + %9 = convert_function %8 to $@noescape @callee_guaranteed @substituted <τ_0_0, τ_0_1> (@in_guaranteed τ_0_0, @in_guaranteed τ_0_1) -> (Bool, @error any Error) for <UInt64, UInt64>, forwarding: @owned |
| 261 | + destroy_value %9 |
| 262 | + %11 = struct $Int32 (%6) |
| 263 | + %12 = builtin "cmp_eq_Word"(%6, %2) : $Builtin.Int1 |
| 264 | + cond_br %12, bb3, bb2 |
| 265 | + |
| 266 | +bb2: |
| 267 | + %14 = integer_literal $Builtin.Int32, 1 |
| 268 | + %15 = integer_literal $Builtin.Int1, -1 |
| 269 | + %16 = builtin "sadd_with_overflow_Word"(%6, %14, %15) : $(Builtin.Int32, Builtin.Int1) |
| 270 | + %17 = tuple_extract %16, 0 |
| 271 | + %18 = enum $Optional<Int32>, #Optional.some!enumelt, %11 |
| 272 | + %19 = unchecked_enum_data %18, #Optional.some!enumelt |
| 273 | + %20 = struct_extract %19, #Int32._value |
| 274 | + %21 = integer_literal $Builtin.Int1, -1 |
| 275 | + %22 = builtin "sadd_with_overflow_Word"(%5, %20, %21) : $(Builtin.Int32, Builtin.Int1) |
| 276 | + %23 = tuple_extract %22, 0 |
| 277 | + br bb1(%23, %17) |
| 278 | + |
| 279 | +bb3: |
| 280 | + %25 = struct $Int32 (%5) |
| 281 | + return %25 |
| 282 | +} |
| 283 | + |
0 commit comments