diff options
| author | bors <bors@rust-lang.org> | 2021-05-05 01:23:01 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-05-05 01:23:01 +0000 |
| commit | 45ccf910703fe7afee30cf223ed046ed2d2afb91 (patch) | |
| tree | 087c1446bf0f4e02b692020c204ae9c4edf44821 /compiler | |
| parent | ae8b84bf04cddda2379b36c45a575132e6a44fb0 (diff) | |
| parent | 9d4c0944cba409a023f640b3c5e28875bce8fbd9 (diff) | |
| download | rust-45ccf910703fe7afee30cf223ed046ed2d2afb91.tar.gz rust-45ccf910703fe7afee30cf223ed046ed2d2afb91.zip | |
Auto merge of #84915 - Mark-Simulacrum:bitset-xor-eq, r=jackh726
Retain data in vectorized registers for longer This seems to be a mild performance improvement on the keccak crate at least, though not sure it'll show up more broadly.
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_index/src/bit_set.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/rustc_index/src/bit_set.rs b/compiler/rustc_index/src/bit_set.rs index d26ab1939e3..df777502c44 100644 --- a/compiler/rustc_index/src/bit_set.rs +++ b/compiler/rustc_index/src/bit_set.rs @@ -355,14 +355,18 @@ where Op: Fn(Word, Word) -> Word, { assert_eq!(out_vec.len(), in_vec.len()); - let mut changed = false; + let mut changed = 0; for (out_elem, in_elem) in iter::zip(out_vec, in_vec) { let old_val = *out_elem; let new_val = op(old_val, *in_elem); *out_elem = new_val; - changed |= old_val != new_val; + // This is essentially equivalent to a != with changed being a bool, but + // in practice this code gets auto-vectorized by the compiler for most + // operators. Using != here causes us to generate quite poor code as the + // compiler tries to go back to a boolean on each loop iteration. + changed |= old_val ^ new_val; } - changed + changed != 0 } const SPARSE_MAX: usize = 8; |
