# \#sil

**URL:** https://forums.swift.org/tag/sil/455.md

[Latest](https://forums.swift.org/latest.md) · [Categories](https://forums.swift.org/categories.md) · [Tags](https://forums.swift.org/tags.md)

---

## [\[Pitch\] Import C structs with ARC pointer members](https://forums.swift.org/t/pitch-import-c-structs-with-arc-pointer-members/64059)

<div class="topic-metadata">

**Author:** [@AdamCmiel](https://forums.swift.org/u/AdamCmiel)\
**Replies:** 15\
**Last updated:** [October 15, 2026, 1:13pm UTC](https://forums.swift.org/t/pitch-import-c-structs-with-arc-pointer-members/64059 "2026-10-15T13:13:41Z")

</div>

Happy Wednesday everyone! We’d like to propose an extension to the ClangImporter for Swift \<\> Objective-C Interop. See a draft PR for importing Automatic Reference Counting (ARC) pointers in C structs in Objective-C mod…

---

## [Existential casting of borrowed values](https://forums.swift.org/t/existential-casting-of-borrowed-values/88617)

<div class="topic-metadata">

**Author:** [@UniverseObserver](https://forums.swift.org/u/UniverseObserver)\
**Replies:** 2\
**Last updated:** [July 29, 2026, 6:48pm UTC](https://forums.swift.org/t/existential-casting-of-borrowed-values/88617 "2026-07-29T18:48:43Z")

</div>

Hi folks, I'm a mentee participating in the 2026 Swift Mentorship program. I have interest in the ownership system but I'm fairly new to the compiler implementation. While I'm investigating Borrowed value with \`as\` cast…

---

## [ML/RL-guided optimization in SIL, prior discussions?](https://forums.swift.org/t/ml-rl-guided-optimization-in-sil-prior-discussions/88547)

<div class="topic-metadata">

**Author:** [@lucasly-ba](https://forums.swift.org/u/lucasly-ba)\
**Replies:** 0\
**Last updated:** [July 26, 2026, 10:44am UTC](https://forums.swift.org/t/ml-rl-guided-optimization-in-sil-prior-discussions/88547 "2026-07-26T10:44:56Z")

</div>

Hi all, I've been contributing to SILOptimizer and got curious about whether there's been any exploration of using ML/RL to guide optimization decisions in SIL, in the spirit of what Google's MLGO does for inlining and …

---

## [Borrowed value with \`as\` casting](https://forums.swift.org/t/borrowed-value-with-as-casting/88236)

<div class="topic-metadata">

**Author:** [@UniverseObserver](https://forums.swift.org/u/UniverseObserver)\
**Replies:** 4\
**Last updated:** [July 23, 2026, 2:12pm UTC](https://forums.swift.org/t/borrowed-value-with-as-casting/88236 "2026-07-23T14:12:30Z")

</div>

Hi, I'm a mentee participating in the Swift Mentorship program. I have interest in the ownership system but I'm fairly new to the compiler implementation. I am picking up issue Compiler crash: \`borrowing\` parameter in a…

---

## [6.5-dev compiler crashes with a SIL verification error](https://forums.swift.org/t/6-5-dev-compiler-crashes-with-a-sil-verification-error/87702)

<div class="topic-metadata">

**Author:** [@sebsto](https://forums.swift.org/u/sebsto)\
**Replies:** 1\
**Last updated:** [June 25, 2026, 9:32pm UTC](https://forums.swift.org/t/6-5-dev-compiler-crashes-with-a-sil-verification-error/87702 "2026-06-25T21:32:03Z")

</div>

Heads up in case anyone else hits this on main: the 6.5-dev compiler crashes with a SIL verification error (debug\_value undef in the OwnershipModelEliminator pass) when an async throws function spawns a Task capturing bo…

---

## [How to efficiently compute ordering of two SILInstructions?](https://forums.swift.org/t/how-to-efficiently-compute-ordering-of-two-silinstructions/77052)

<div class="topic-metadata">

**Author:** [@jamieQ](https://forums.swift.org/u/jamieQ)\
**Replies:** 2\
**Last updated:** [February 1, 2026, 2:41pm UTC](https://forums.swift.org/t/how-to-efficiently-compute-ordering-of-two-silinstructions/77052 "2026-02-01T14:41:26Z")

</div>

i've been looking into some of the proposed improvements for DI performance outlined here, but have run into an issue i don't quite understand how to handle. specifically, if i have two SILInstructions that are known to …

---

## [How to write good FileCheck tests for SIL?](https://forums.swift.org/t/how-to-write-good-filecheck-tests-for-sil/84273)

<div class="topic-metadata">

**Author:** [@jamieQ](https://forums.swift.org/u/jamieQ)\
**Replies:** 2\
**Last updated:** [January 22, 2026, 11:22am UTC](https://forums.swift.org/t/how-to-write-good-filecheck-tests-for-sil/84273 "2026-01-22T11:22:51Z")

</div>

having now written a handful of FileCheck tests for SIL, i was wondering if anyone had any tips for effective patterns/guidelines for such tests. i somewhat frequently find myself doing what feels like just copy/pasting …

---

## [Question about OSSA, \`destroy\_value\`, and \`unowned\_release\`](https://forums.swift.org/t/question-about-ossa-destroy-value-and-unowned-release/83881)

<div class="topic-metadata">

**Author:** [@jamieQ](https://forums.swift.org/u/jamieQ)\
**Replies:** 2\
**Last updated:** [December 30, 2025, 11:06am UTC](https://forums.swift.org/t/question-about-ossa-destroy-value-and-unowned-release/83881 "2025-12-30T11:06:00Z")

</div>

the current SIL docs say this regarding the destroy\_value instruction (emphasis mine): For trivial types, this is a no-op. For reference types, this is equivalent to a strong\_release. For @unowned types, this is equiva…

---

## [Different returned type when using some vs any in function signature on a view](https://forums.swift.org/t/different-returned-type-when-using-some-vs-any-in-function-signature-on-a-view/77717)

<div class="topic-metadata">

**Author:** [@vicente](https://forums.swift.org/u/vicente)\
**Replies:** 1\
**Last updated:** [February 7, 2025, 7:21pm UTC](https://forums.swift.org/t/different-returned-type-when-using-some-vs-any-in-function-signature-on-a-view/77717 "2025-02-07T19:21:52Z")

</div>

Hello, given the following code protocol Service: Sendable {} struct Impl: Service {} struct AView: View { private let service: any Service init(service: any Service) { self.service = service } …

---

## [Emit SIL per module into build products?](https://forums.swift.org/t/emit-sil-per-module-into-build-products/77680)

<div class="topic-metadata">

**Author:** [@DJBen](https://forums.swift.org/u/DJBen)\
**Replies:** 4\
**Last updated:** [February 5, 2025, 11:48pm UTC](https://forums.swift.org/t/emit-sil-per-module-into-build-products/77680 "2025-02-05T23:48:13Z")

</div>

Hi, I would like to dump all the symbols and methods type-resolved with source module. SIL looks promising. However the -emit-sil -o File option can only specify one output file, as the error below error: cannot specif…

---

## [Definite initialization: accidentally or essentially quadratic?](https://forums.swift.org/t/definite-initialization-accidentally-or-essentially-quadratic/76298)

<div class="topic-metadata">

**Author:** [@jamieQ](https://forums.swift.org/u/jamieQ)\
**Replies:** 5\
**Last updated:** [January 13, 2025, 1:31pm UTC](https://forums.swift.org/t/definite-initialization-accidentally-or-essentially-quadratic/76298 "2025-01-13T13:31:24Z")

</div>

consider code of the following form: class C { var prop1: Int var prop2: Int var prop3: Int // ... var propN: Int } now suppose we implement the init method to assign default values to all the properties as s…

---

## [Questions about the ClosureLifetimeFixup pass](https://forums.swift.org/t/questions-about-the-closurelifetimefixup-pass/70004)

<div class="topic-metadata">

**Author:** [@jkshtj](https://forums.swift.org/u/jkshtj)\
**Replies:** 15\
**Last updated:** [May 8, 2024, 11:58pm UTC](https://forums.swift.org/t/questions-about-the-closurelifetimefixup-pass/70004 "2024-05-08T23:58:09Z")

</div>

Hi, I am looking at an issue in Swift Autodiff where we're generating unoptimized code when the derivative of a function is called from a conditional control-flow context. Upon digging further I found out that the Clos…

---

## [Closure specialization for reabstracted closures](https://forums.swift.org/t/closure-specialization-for-reabstracted-closures/71097)

<div class="topic-metadata">

**Author:** [@jkshtj](https://forums.swift.org/u/jkshtj)\
**Replies:** 1\
**Last updated:** [April 8, 2024, 8:36pm UTC](https://forums.swift.org/t/closure-specialization-for-reabstracted-closures/71097 "2024-04-08T20:36:37Z")

</div>

As it stands the closure-specialization optimization specializes a callsite against a closure that has undergone reabstractions (via reabstraction thunks) only if the final closure is passed in as a @noescape thick funct…

---

## [Non-inout indirect types not supported in closure-specialization optimization](https://forums.swift.org/t/non-inout-indirect-types-not-supported-in-closure-specialization-optimization/70826)

<div class="topic-metadata">

**Author:** [@jkshtj](https://forums.swift.org/u/jkshtj)\
**Replies:** 2\
**Last updated:** [March 21, 2024, 7:44pm UTC](https://forums.swift.org/t/non-inout-indirect-types-not-supported-in-closure-specialization-optimization/70826 "2024-03-21T19:44:19Z")

</div>

The closure-specialization optimization currently does not support non-inout indirect arguments. However, I could not find any explanation as to why they aren't (other than saying that it's a temporary limitation). So, …

---

## [SILDebugLocation vs SILDebugScope](https://forums.swift.org/t/sildebuglocation-vs-sildebugscope/70504)

<div class="topic-metadata">

**Author:** [@jkshtj](https://forums.swift.org/u/jkshtj)\
**Replies:** 0\
**Last updated:** [March 7, 2024, 8:22pm UTC](https://forums.swift.org/t/sildebuglocation-vs-sildebugscope/70504 "2024-03-07T20:22:32Z")

</div>

What is the difference between and the purpose of the SILDebugLocation and SILDebugScope types?

---

## [Have a question regarding the content of an article about SIL](https://forums.swift.org/t/have-a-question-regarding-the-content-of-an-article-about-sil/68561)

<div class="topic-metadata">

**Author:** [@Kobe24](https://forums.swift.org/u/Kobe24)\
**Replies:** 0\
**Last updated:** [November 21, 2023, 8:05am UTC](https://forums.swift.org/t/have-a-question-regarding-the-content-of-an-article-about-sil/68561 "2023-11-21T08:05:29Z")

</div>

Hello, I am Kobe from South Korea, currently studying iOS and Swift.:man\_bowing:t2: I am writing this post because I have a question regarding the content of an article about SIL (Swift Intermediate Language) on a Korea…

---

## [Debugging SIL optimizations on Builtins](https://forums.swift.org/t/debugging-sil-optimizations-on-builtins/68371)

<div class="topic-metadata">

**Author:** [@carlos42421](https://forums.swift.org/u/carlos42421)\
**Replies:** 7\
**Last updated:** [November 10, 2023, 5:45am UTC](https://forums.swift.org/t/debugging-sil-optimizations-on-builtins/68371 "2023-11-10T05:45:40Z")

</div>

In order to write/read hardware registers on our platform, I've added two special functions to our standard library... @\_transparent @\_effects(readwrite) public func \_rawPointerWrite\<Pointee\>(address: Int, value: Pointe…

---

## [Numerical metrics of code quality](https://forums.swift.org/t/numerical-metrics-of-code-quality/67680)

<div class="topic-metadata">

**Author:** [@Pogosito](https://forums.swift.org/u/Pogosito)\
**Replies:** 0\
**Last updated:** [October 5, 2023, 6:23am UTC](https://forums.swift.org/t/numerical-metrics-of-code-quality/67680 "2023-10-05T06:23:40Z")

</div>

Hi Swift Forum! Are there any numerical metrics of code quality that could give information about the project and how to improve it? The results of google search on this topic today speak only about quality metrics: re…

---

## [Ideas for debugging a bad memory access at runtime](https://forums.swift.org/t/ideas-for-debugging-a-bad-memory-access-at-runtime/67468)

<div class="topic-metadata">

**Author:** [@jkshtj](https://forums.swift.org/u/jkshtj)\
**Replies:** 1\
**Last updated:** [September 23, 2023, 4:25pm UTC](https://forums.swift.org/t/ideas-for-debugging-a-bad-memory-access-at-runtime/67468 "2023-09-23T16:25:36Z")

</div>

I'm trying to get some guidance/ideas/suggestions on a bad runtime memory access that I have encountered. I have a SIL function x, which returns a closure y, whose signature looks as below - sil private @y : $@conventi…

---

## [Debugging SIL in LLDB](https://forums.swift.org/t/debugging-sil-in-lldb/66378)

<div class="topic-metadata">

**Author:** [@jkshtj](https://forums.swift.org/u/jkshtj)\
**Replies:** 1\
**Last updated:** [July 31, 2023, 4:21pm UTC](https://forums.swift.org/t/debugging-sil-in-lldb/66378 "2023-07-31T16:21:35Z")

</div>

Has anyone ever tried debugging SIL code in LLDB as mentioned here? If yes, is there a way I can print a SIL value such as, %1 in LLDB?

---

## [SIL strong\_release behavior](https://forums.swift.org/t/sil-strong-release-behavior/66387)

<div class="topic-metadata">

**Author:** [@jkshtj](https://forums.swift.org/u/jkshtj)\
**Replies:** 1\
**Last updated:** [July 26, 2023, 9:04pm UTC](https://forums.swift.org/t/sil-strong-release-behavior/66387 "2023-07-26T21:04:03Z")

</div>

I am trying to understand memory deallocation behavior at the SIL level. I have this simple swift program: import Foundation class A { let x: Int init(x: Int) { self.x = x } } var \_ = A(x: 42) The…

---

## [Why does the Swift compiler continue optimizing SIL even after SIL verification failures?](https://forums.swift.org/t/why-does-the-swift-compiler-continue-optimizing-sil-even-after-sil-verification-failures/65711)

<div class="topic-metadata">

**Author:** [@jkshtj](https://forums.swift.org/u/jkshtj)\
**Replies:** 8\
**Last updated:** [June 20, 2023, 10:29pm UTC](https://forums.swift.org/t/why-does-the-swift-compiler-continue-optimizing-sil-even-after-sil-verification-failures/65711 "2023-06-20T22:29:08Z")

</div>

Hi all, I'm looking into a compilation bug (SIL verification failure when evaluating \`$0\` in certain closures. · Issue #66312 · apple/swift · GitHub) in the Swift compiler. The issue is happening due to SIL verification…

---

## [SILFunction type mismatch compiler bug](https://forums.swift.org/t/silfunction-type-mismatch-compiler-bug/64927)

<div class="topic-metadata">

**Author:** [@Kyle-Ye](https://forums.swift.org/u/Kyle-Ye)\
**Replies:** 0\
**Last updated:** [May 11, 2023, 3:37am UTC](https://forums.swift.org/t/silfunction-type-mismatch-compiler-bug/64927 "2023-05-11T03:37:59Z")

</div>

If the type is very complicated(Contains type cross different module), it will build fail with a swift compiler crash saying "SILFunction type mismatch". The concrete issue is one will have @out sil mark and one wouldn'…

---

## [\[RFC\] The debug\_value\_addr SIL instruction deprecation roadmap](https://forums.swift.org/t/rfc-the-debug-value-addr-sil-instruction-deprecation-roadmap/51377)

<div class="topic-metadata">

**Author:** [@mshockwave](https://forums.swift.org/u/mshockwave)\
**Replies:** 0\
**Last updated:** [August 20, 2021, 9:03pm UTC](https://forums.swift.org/t/rfc-the-debug-value-addr-sil-instruction-deprecation-roadmap/51377 "2021-08-20T21:03:36Z")

</div>

Preface The debug\_value\_addr instruction has been used to associate a pointer-type (SIL) SSA value with a debug variable. It is nearly identical to debug\_value in terms of functionality, except that one can only use poin…

---

## [How does init\_existential\_addr work in SIL?](https://forums.swift.org/t/how-does-init-existential-addr-work-in-sil/45054)

<div class="topic-metadata">

**Author:** [@Alvae](https://forums.swift.org/u/Alvae)\
**Replies:** 2\
**Last updated:** [February 25, 2021, 10:47am UTC](https://forums.swift.org/t/how-does-init-existential-addr-work-in-sil/45054 "2021-02-25T10:47:09Z")

</div>

Hello everyone, I'm trying to make sense the way existential containers are represented/handled at the SIL level. Unfortunately, I am struggling to understand a couple of things, and were hoping for your enlightenment. …

---

## [Make \`ApplyInst\` a \`MultipleValueInstruction\`?](https://forums.swift.org/t/make-applyinst-a-multiplevalueinstruction/42294)

<div class="topic-metadata">

**Author:** [@dan-zheng](https://forums.swift.org/u/dan-zheng)\
**Replies:** 4\
**Last updated:** [November 27, 2020, 4:22am UTC](https://forums.swift.org/t/make-applyinst-a-multiplevalueinstruction/42294 "2020-11-27T04:22:36Z")

</div>

Context SIL supports instructions that produce multiple values (i.e. multiple result SILValues). However, apply instructions don't produce multiple values. Instead, they produce a single value, which may have a tuple ty…
