diff options
| author | kennytm <kennytm@gmail.com> | 2018-02-14 23:18:18 +0800 |
|---|---|---|
| committer | kennytm <kennytm@gmail.com> | 2018-02-15 00:04:18 +0800 |
| commit | ec36e7e972e8036fe7bd428458462a2aacd40927 (patch) | |
| tree | 109c76360757678ea286052290b03c29e0bdedf7 | |
| parent | 7984c895b6995703254035e81d0a85ae1fa9fe2b (diff) | |
| download | rust-ec36e7e972e8036fe7bd428458462a2aacd40927.tar.gz rust-ec36e7e972e8036fe7bd428458462a2aacd40927.zip | |
Partially revert #47333.
Removed the `assume()` which we assumed is the cause of misoptimization in issue #48116.
| -rw-r--r-- | src/libcore/slice/mod.rs | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index aacbbd5058e..ac390313a67 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -1246,15 +1246,18 @@ macro_rules! iterator { { // The addition might panic on overflow // Use the len of the slice to hint optimizer to remove result index bounds check. - let n = make_slice!(self.ptr, self.end).len(); + let _n = make_slice!(self.ptr, self.end).len(); self.try_fold(0, move |i, x| { if predicate(x) { Err(i) } else { Ok(i + 1) } }).err() - .map(|i| { - unsafe { assume(i < n) }; - i - }) + // // FIXME(#48116/#45964): + // // This assume() causes misoptimization on LLVM 6. + // // Commented out until it is fixed again. + // .map(|i| { + // unsafe { assume(i < n) }; + // i + // }) } #[inline] @@ -1271,10 +1274,13 @@ macro_rules! iterator { if predicate(x) { Err(i) } else { Ok(i) } }).err() - .map(|i| { - unsafe { assume(i < n) }; - i - }) + // // FIXME(#48116/#45964): + // // This assume() causes misoptimization on LLVM 6. + // // Commented out until it is fixed again. + // .map(|i| { + // unsafe { assume(i < n) }; + // i + // }) } } |
