Partially revert #47333.
Removed the `assume()` which we assumed is the cause of misoptimization in issue #48116.
This commit is contained in:
parent
7984c895b6
commit
ec36e7e972
|
@ -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
|
||||
// })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue