Files
Mike Ash 024e12c3bd Make swift/llvm_unreachable use builtin_trap instead of builtin_unreachable.
Also replace LLVM_BUILTIN_UNREACHABLE with LLVM_BUILTIN_TRAP in a few places where it's used directly.

builtin_unreachable is undefined behavior when reached, which makes it a major hazard, as the optimizer will happly eliminate branches that lead to one. This can make for difficult debugging experiences or arbitrary bad behavior at runtime as we end up on "impossible" code paths when there's unexpected data. It works in cases where the code is provably unreachable, but in practice it often ends up in places where execution shouldn't reach but can due to bugs or unanticipated input.

This change will have a small penalty to performance (due to checks that previously got optimized out) and code size (due to code paths that previously got optimized out). This should be negligible.
2026-11-06 16:01:49 -05:00
..