Backport LLVM fixes for a JumpThreading / assume intrinsic bug

This commit is contained in:
Björn Steinbrink 2018-02-27 14:20:13 +01:00
parent 29f5c699b1
commit f05d9679d7
2 changed files with 10 additions and 16 deletions

View file

@ -1246,18 +1246,15 @@ 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()
// // FIXME(#48116/#45964):
// // This assume() causes misoptimization on LLVM 6.
// // Commented out until it is fixed again.
// .map(|i| {
// unsafe { assume(i < n) };
// i
// })
.map(|i| {
unsafe { assume(i < n) };
i
})
}
#[inline]
@ -1274,13 +1271,10 @@ macro_rules! iterator {
if predicate(x) { Err(i) }
else { Ok(i) }
}).err()
// // FIXME(#48116/#45964):
// // This assume() causes misoptimization on LLVM 6.
// // Commented out until it is fixed again.
// .map(|i| {
// unsafe { assume(i < n) };
// i
// })
.map(|i| {
unsafe { assume(i < n) };
i
})
}
}

@ -1 +1 @@
Subproject commit 9f81beaf32608fbe1fe0f2a82f974e800e9d8c62
Subproject commit 5c6b7fea4a302261f18b1cc6ea22b2a9eec2abd9