diff options
| author | bors <bors@rust-lang.org> | 2021-06-21 22:24:13 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-06-21 22:24:13 +0000 |
| commit | 4573a4a879a8e1f773944a8859e4dcd136138af8 (patch) | |
| tree | 88a7b7c8c5df3b57c51f2cc71c1ba877c0f2aa86 /compiler/rustc_span/src | |
| parent | 406d4a9cc3b9601cf98a07c6c83e0227d64f5d48 (diff) | |
| parent | aa53928ed7b763abd882f2a5efb8f98f53ccc6a9 (diff) | |
| download | rust-4573a4a879a8e1f773944a8859e4dcd136138af8.tar.gz rust-4573a4a879a8e1f773944a8859e4dcd136138af8.zip | |
Auto merge of #86383 - shamatar:slice_len_lowering, r=bjorn3
Add MIR pass to lower call to `core::slice::len` into `Len` operand During some larger experiment with range analysis I've found that code like `let l = slice.len()` produces different MIR then one found in bound checks. This optimization pass replaces terminators that are calls to `core::slice::len` with just a MIR operand and Goto terminator. It uses some heuristics to remove the outer borrow that is made to call `core::slice::len`, but I assume it can be eliminated, just didn't find how. Would like to express my gratitude to `@oli-obk` who helped me a lot on Zullip
Diffstat (limited to 'compiler/rustc_span/src')
| -rw-r--r-- | compiler/rustc_span/src/symbol.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 862bde3f6a3..b81d29930ee 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -680,6 +680,7 @@ symbols! { lateout, lazy_normalization_consts, le, + len, let_chains, lhs, lib, @@ -1147,6 +1148,7 @@ symbols! { skip, slice, slice_alloc, + slice_len_fn, slice_patterns, slice_u8, slice_u8_alloc, |
