Add a new mandatory BooleanLiteralFolding pass which constant folds conditional branches with boolean literals as operands.
```
%1 = integer_literal -1
%2 = apply %bool_init(%1) // Bool.init(_builtinBooleanLiteral:)
%3 = struct_extract %2, #Bool._value
cond_br %3, bb1, bb2
```
->
```
...
br bb1
```
This pass is intended to run before DefiniteInitialization, where mandatory inlining and constant folding didn't run, yet (which would perform this kind of optimization).
This optimization is required to let DefiniteInitialization handle boolean literals correctly.
For example in infinite loops:
```
init() {
while true { // DI need to know that there is no loop exit from this while-statement
if some_condition {
member_field = init_value
break
}
}
}
```
* [Diagnostics] Use DeclDescriptiveKind on data flow diagnostics to improve diagnostic message
* [tests] Add regression tests to SILOptimizer/return.swift
* [tests] Adapt other tests to changes of SR-14505
* [Diagnostics] Adapt message for missing return diagnostics, remove article
* [Diagnostics] Adapt message for missing return diagnostics to have a note with fix
* [tests] Adjust tests in validation suit
The problem was that the unreachable instruction after the IUO unwrapping error call was interpreted as missing-return-unreachable.
rdar://problem/36611041
Turn on the noreturn diagnostic for cases where a reachable unreachable
could be encountered. Previously, the diagnostic would not fire if the
function was marked noreturn and any of its reachable unreachable calls
were around. While this makes sense from a SILGen perspective (it Just
Crashes tm), it is still wrong. We need to diagnose *everything* that
has reachable unreachables.
Previously, isNever would return true for an equivalence class of
uninhabited enums. The rest of the compiler, however, is using this in
places that actually expect just the Never type. This means that code
like this would compile properly
enum Uninhabited {}
func do() -> Uninhabited { /* No body here */ }
and we wouldn’t diagnose the missing return.