You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[SILOptimizer] Don't diagnose unreachable instructions that belong to no-return func
The pass is attempting to diagnose any user-written code that appears
after the result of no-return function call. It has to skip any
instructions that happen after the no-return call but are associated
with it, such as `alloc_stack` to pass result of such call indirectly.
This helps to avoid extraneous diagnostics for synthesized code i.e.
a result builder with `buildExpression`:
```
static func buildExpression<T>(_ e: T) -> T { e }
```
The following example would produce extraneous warning:
```
switch <value> {
case ...
default: fatalError()
}
```
because it is translated into:
```
switch <value> {
case ...
default: {
var $__builderDefault = buildExpression(fatalError())
$__builderSwitch = buildEither(second: $__builderDefault)
}
}
```
In such cases all instructions that follow `fatalError()` call
are synthesized except to `alloc_stack $Never` which is passed
to `buildExpression`, that instruction is anchored on the
`fatalError()` itself which is where the diagnostic would point,
which is incorrect.
Resolves: rdar://104775183
0 commit comments