Files
swift-mirror/test/SILOptimizer/cast_folding_opaque.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

13 lines
995 B
Swift

// RUN: %target-swift-frontend -enable-library-evolution -disable-availability-checking -O -Xllvm -sil-print-types -emit-sil %s %S/Inputs/cast_folding_opaque_other.swift -module-name cast_folding_opaque
// RUN: %target-swift-frontend -enable-library-evolution -disable-availability-checking -Onone -Xllvm -sil-print-types -emit-sil -primary-file %s %S/Inputs/cast_folding_opaque_other.swift -module-name cast_folding_opaque | %FileCheck %s
// CHECK-LABEL: sil @$s19cast_folding_opaque23testCastOpaqueArchetypeAA10UnderlyingVyF
// CHECK: [[O:%.*]] = alloc_stack $@_opaqueReturnTypeOf("$s19cast_folding_opaque12returnOpaqueQryF", 0)
// CHECK: [[F:%.*]] = function_ref @$s19cast_folding_opaque12returnOpaqueQryF
// CHECK: apply [[F]]([[O]])
// CHECK: unconditional_checked_cast_addr @_opaqueReturnTypeOf{{.*}}in [[O]] : $*@_opaqueReturnTypeOf{{.*}}to Underlying in %0 : $*Underlying
@inlinable
public func testCastOpaqueArchetype() -> Underlying {
return returnOpaque() as! Underlying
}