mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
* access * accessed * accesses * accessor * acquiring * across * activated * additive * address * addresses' * aggregated * analysis * and * appropriately * archetype * argument * associated * availability * barriers * because * been * beginning * belongs * beneficial * blocks * borrow * builtin * cannot * canonical * canonicalize * clazz * cleanup * coalesceable * coalesced * comparisons * completely * component * computed * concrete * conjunction * conservatively * constituent * construct * consuming * containing * covered * creates * critical * dataflow * declaration * defined * defining * definition * deinitialization * deliberately * dependencies * dependent * deserialized * destroy * deterministic * deterministically * devirtualizes * diagnostic * diagnostics * differentiation * disable * discipline * dominate * dominates * don't * element * eliminate * eliminating * elimination * embedded * encounter * epilogue * epsilon * escape * escaping * essential * evaluating * evaluation * evaluator * executing * existential * existentials * explicit * expression * extended * extension * extract * for * from * function * generic * guarantee * guaranteed * happened * heuristic * however * identifiable * immediately * implementation * improper * include * infinite * initialize * initialized * initializer * inside * instruction * interference * interferes * interleaved * internal * intersection * intractable * intrinsic * invalidates * irreducible * irrelevant * language * lifetime * literal * looks * materialize * meaning * mergeable * might * mimics * modification * modifies * multiple * mutating * necessarily * necessary * needsmultiplecopies * nonetheless * nothing * occurred * occurs * optimization * optimizing * original * outside * overflow * overlapping * overridden * owned * ownership * parallel * parameter * paths * patterns * pipeline * plottable * possible * potentially * practically * preamble * precede * preceding * predecessor * preferable * preparation * probably * projection * properties * property * protocol * reabstraction * reachable * recognized * recursive * recursively * redundant * reentrancy * referenced * registry * reinitialization * reload * represent * requires * response * responsible * retrieving * returned * returning * returns * rewriting * rewritten * sample * scenarios * scope * should * sideeffects * similar * simplify * simplifycfg * somewhat * spaghetti * specialization * specializations * specialized * specially * statistically * substitute * substitution * succeeds * successful * successfully * successor * superfluous * surprisingly * suspension * swift * targeted * that * that our * the * therefore * this * those * threshold * through * transform * transformation * truncated * ultimate * unchecked * uninitialized * unlikely * unmanaged * unoptimized key * updataflow * usefulness * utilities * villain * whenever * writes Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
99 lines
2.6 KiB
Plaintext
99 lines
2.6 KiB
Plaintext
// RUN: %target-sil-opt -enable-sil-verify-all -simplify-cfg %s | %FileCheck %s
|
|
//
|
|
// Make sure that we can successfully call simplify-cfg with that name via sil-opt.
|
|
|
|
sil_stage canonical
|
|
|
|
import Builtin
|
|
import Swift
|
|
|
|
internal enum Enum {
|
|
case one
|
|
case two
|
|
}
|
|
|
|
// CHECK-LABEL: sil @simple_test : $@convention(thin) () -> () {
|
|
// CHECK: bb0:
|
|
// CHECK-NEXT: tuple
|
|
// CHECK-NEXT: return
|
|
// CHECK: } // end sil function 'simple_test'
|
|
sil @simple_test : $@convention(thin) () -> () {
|
|
bb0:
|
|
%0 = integer_literal $Builtin.Int1, -1
|
|
cond_br %0, bb1, bb2
|
|
|
|
bb1:
|
|
br bb3
|
|
|
|
bb2:
|
|
br bb3
|
|
|
|
bb3:
|
|
%9999 = tuple ()
|
|
return %9999 : $()
|
|
}
|
|
|
|
// Test that SimplifyCFG::simplifyBlocks, tryJumpThreading does not
|
|
// perform unbounded loop peeling.
|
|
//
|
|
// rdar://73357726
|
|
// https://github.com/apple/swift/issues/56457
|
|
// Compiling with optimisation runs indefinitely for grpc-swift
|
|
//
|
|
// CHECK-LABEL: sil @testInfinitePeeling : $@convention(method) (Builtin.Int64, Enum) -> () {
|
|
//
|
|
// There is only one switch_enum blocks, and it is no longer in a loop.
|
|
// CHECK: bb0(%0 : $Builtin.Int64, %1 : $Enum):
|
|
// CHECK: switch_enum %1 : $Enum, case #Enum.one!enumelt: bb3, case #Enum.two!enumelt: bb4
|
|
// CHECK: bb1:
|
|
// CHECK: br bb8
|
|
// CHECK: bb2:
|
|
// CHECK: br bb5(%{{.*}} : $Enum)
|
|
//
|
|
// This is the original cond_br block
|
|
// CHECK: bb3:
|
|
// CHECK: cond_br %{{.*}}, bb2, bb1
|
|
// CHECK: bb4:
|
|
// CHECK: br bb5(%1 : $Enum)
|
|
//
|
|
// This is the cond_br block after jump-threading.
|
|
// CHECK: bb5(%{{.*}} : $Enum):
|
|
// CHECK: cond_br %{{.*}}, bb6, bb7
|
|
// CHECK: bb6:
|
|
// CHECK: br bb5(%{{.*}} : $Enum)
|
|
// CHECK: bb7:
|
|
// CHECK: br bb8
|
|
// CHECK: bb8:
|
|
// CHECK: return %19 : $()
|
|
// CHECK-LABEL: } // end sil function 'testInfinitePeeling'
|
|
sil @testInfinitePeeling : $@convention(method) (Builtin.Int64, Enum) -> () {
|
|
bb0(%0 : $Builtin.Int64, %1 : $Enum):
|
|
%2 = integer_literal $Builtin.Int64, 99999999
|
|
br bb1(%0 : $Builtin.Int64, %1 : $Enum)
|
|
|
|
bb1(%4 : $Builtin.Int64, %5 : $Enum):
|
|
switch_enum %5 : $Enum, case #Enum.one!enumelt: bb4, default bb5
|
|
|
|
bb2(%7 : $Builtin.Int64, %8 : $Enum):
|
|
%9 = builtin "cmp_slt_Int64"(%2 : $Builtin.Int64, %7 : $Builtin.Int64) : $Builtin.Int1
|
|
cond_br %9, bb3, bb6
|
|
|
|
bb3:
|
|
br bb1(%7 : $Builtin.Int64, %8 : $Enum)
|
|
|
|
bb4:
|
|
%12 = integer_literal $Builtin.Int64, 1
|
|
%13 = integer_literal $Builtin.Int1, -1
|
|
%14 = builtin "sadd_with_overflow_Int64"(%4 : $Builtin.Int64, %12 : $Builtin.Int64, %13 : $Builtin.Int1) : $(Builtin.Int64, Builtin.Int1)
|
|
%15 = tuple_extract %14 : $(Builtin.Int64, Builtin.Int1), 0
|
|
%16 = enum $Enum, #Enum.two!enumelt
|
|
br bb2(%15 : $Builtin.Int64, %16 : $Enum)
|
|
|
|
bb5:
|
|
br bb2(%2 : $Builtin.Int64, %5 : $Enum)
|
|
|
|
bb6:
|
|
%19 = tuple ()
|
|
return %19 : $()
|
|
}
|