about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs
diff options
context:
space:
mode:
authorPietro Albini <pietro.albini@ferrous-systems.com>2021-10-27 15:45:31 +0200
committerPietro Albini <pietro.albini@ferrous-systems.com>2021-10-27 17:01:05 +0200
commit68a4460b614bc925a12231d5bba04dd66cb78c6e (patch)
tree4932dde79a35989123774b2a219eecdf45752e50 /compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs
parent81130fe188ff37f2deacdf53d7afe823ceaba7ec (diff)
downloadrust-68a4460b614bc925a12231d5bba04dd66cb78c6e.tar.gz
rust-68a4460b614bc925a12231d5bba04dd66cb78c6e.zip
replace `&` with `&&` in {integer}::checked_rem
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 eax, 1
ret
```
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs')
0 files changed, 0 insertions, 0 deletions