mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Type annotations for instruction operands are omitted, e.g. ``` %3 = struct $S(%1, %2) ``` Operand types are redundant anyway and were only used for sanity checking in the SIL parser. But: operand types _are_ printed if the definition of the operand value was not printed yet. This happens: * if the block with the definition appears after the block where the operand's instruction is located * if a block or instruction is printed in isolation, e.g. in a debugger The old behavior can be restored with `-Xllvm -sil-print-types`. This option is added to many existing test files which check for operand types in their check-lines.
39 lines
950 B
Plaintext
39 lines
950 B
Plaintext
// RUN: %target-sil-opt -sil-print-types -enable-sil-verify-all %s -early-redundant-load-elimination | %FileCheck %s
|
|
|
|
// REQUIRES: swift_in_compiler
|
|
|
|
sil_stage canonical
|
|
|
|
import Builtin
|
|
import Swift
|
|
import SwiftShims
|
|
|
|
|
|
// Check that earlyl redundant load elimination ignores arrays.
|
|
|
|
|
|
// CHECK-LABEL: test_array
|
|
// CHECK: %1 = load
|
|
// CHECK: %2 = load
|
|
// CHECK: %3 = tuple (%1 {{.*}}, %2 {{.*}})
|
|
sil @test_array : $@convention(thin) (@inout Array<Int>) -> (Array<Int>, Array<Int>) {
|
|
bb0(%0 : $*Array<Int>):
|
|
%1 = load %0 : $*Array<Int>
|
|
%2 = load %0 : $*Array<Int>
|
|
%3 = tuple (%1: $Array<Int>, %2: $Array<Int>)
|
|
return %3 : $(Array<Int>, Array<Int>)
|
|
}
|
|
|
|
// CHECK-LABEL: test_non_array
|
|
// CHECK: %1 = load
|
|
// CHECK: %2 = tuple (%1 {{.*}}, %1 {{.*}})
|
|
sil @test_non_array : $@convention(thin) (@inout Int) -> (Int, Int) {
|
|
bb0(%0 : $*Int):
|
|
%1 = load %0 : $*Int
|
|
%2 = load %0 : $*Int
|
|
%3 = tuple (%1: $Int, %2: $Int)
|
|
return %3 : $(Int, Int)
|
|
}
|
|
|
|
|