diff options
| author | Pietro Albini <pietro.albini@ferrous-systems.com> | 2021-10-27 15:25:00 +0200 |
|---|---|---|
| committer | Pietro Albini <pietro.albini@ferrous-systems.com> | 2021-10-27 17:00:57 +0200 |
| commit | 81130fe188ff37f2deacdf53d7afe823ceaba7ec (patch) | |
| tree | f8069d81d3139bfc496da4ed369126cd564d0e3f /compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs | |
| parent | a5a8bb012540c23a9b4ab5a38bc7f75d5ebaba60 (diff) | |
| download | rust-81130fe188ff37f2deacdf53d7afe823ceaba7ec.tar.gz rust-81130fe188ff37f2deacdf53d7afe823ceaba7ec.zip | |
replace `&` with `&&` in {integer}::checked_div
Using short-circuit operators makes it easier to perform some kinds of source code analysis, like MC/DC code coverage (a requirement in safety-critical environments). The optimized x86 assembly is the same between the old and new versions: ``` xor eax, eax test esi, esi je .LBB0_1 cmp edi, -2147483648 jne .LBB0_4 cmp esi, -1 jne .LBB0_4 ret .LBB0_1: ret .LBB0_4: mov eax, edi cdq idiv esi mov edx, eax mov eax, 1 ret ```
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs')
0 files changed, 0 insertions, 0 deletions
