Files
swift-mirror/test/SILOptimizer/onone_simplifications.swift
Erik Eckstein 7cceaff5f3 SIL: don't print operand types in textual SIL
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.
2024-11-21 18:49:52 +01:00

40 lines
1.4 KiB
Swift

// RUN: %target-swift-frontend -primary-file %s -module-name=test -Xllvm -sil-print-types -Xllvm -sil-print-debuginfo -emit-sil | %FileCheck %s
// REQUIRES: swift_in_compiler
// CHECK-LABEL: sil [transparent] @$s4test9checkTypeySixs17FixedWidthIntegerRzlF
@_transparent
public func checkType<A: FixedWidthInteger>(_ a: A) -> Int {
// CHECK-NOT: builtin
// CHECK: debug_step , loc "{{[^"]+}}":[[# @LINE + 1]]
if _isConcrete(A.self) {
// CHECK-NOT: builtin
if A.self == Int.self {
return 1
}
}
return 0
}
// CHECK: } // end sil function '$s4test9checkTypeySixs17FixedWidthIntegerRzlF'
// CHECK-LABEL: sil @$s4test0A10IsConcreteSiyF
public func testIsConcrete() -> Int {
// CHECK: debug_step , loc "{{[^"]+}}":[[# @LINE + 1]]:3
checkType(1)
// CHECK: [[IL:%[0-9]+]] = integer_literal $Builtin.Int{{[0-9]+}}, 1
// CHECK: [[I:%[0-9]+]] = struct $Int ([[IL]] :
// CHECK: return [[I]]
}
// CHECK: } // end sil function '$s4test0A10IsConcreteSiyF'
// CHECK-LABEL: sil @$s4test0A17MetadatComparisonSbyF
public func testMetadatComparison() -> Bool {
// CHECK: debug_step , loc "{{[^"]+}}":[[# @LINE + 1]]
[String: Int].self == Never.self
// CHECK: [[IL:%[0-9]+]] = integer_literal $Builtin.Int1, 0
// CHECK: [[I:%[0-9]+]] = struct $Bool ([[IL]] :
// CHECK: return [[I]]
}
// CHECK: } // end sil function '$s4test0A17MetadatComparisonSbyF'