Skip to content

Commit ec36e7e

Browse files
committed
Partially revert #47333.
Removed the `assume()` which we assumed is the cause of misoptimization in issue #48116.
1 parent 7984c89 commit ec36e7e

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/libcore/slice/mod.rs

+15-9
Original file line numberDiff line numberDiff line change
@@ -1246,15 +1246,18 @@ macro_rules! iterator {
12461246
{
12471247
// The addition might panic on overflow
12481248
// Use the len of the slice to hint optimizer to remove result index bounds check.
1249-
let n = make_slice!(self.ptr, self.end).len();
1249+
let _n = make_slice!(self.ptr, self.end).len();
12501250
self.try_fold(0, move |i, x| {
12511251
if predicate(x) { Err(i) }
12521252
else { Ok(i + 1) }
12531253
}).err()
1254-
.map(|i| {
1255-
unsafe { assume(i < n) };
1256-
i
1257-
})
1254+
// // FIXME(#48116/#45964):
1255+
// // This assume() causes misoptimization on LLVM 6.
1256+
// // Commented out until it is fixed again.
1257+
// .map(|i| {
1258+
// unsafe { assume(i < n) };
1259+
// i
1260+
// })
12581261
}
12591262

12601263
#[inline]
@@ -1271,10 +1274,13 @@ macro_rules! iterator {
12711274
if predicate(x) { Err(i) }
12721275
else { Ok(i) }
12731276
}).err()
1274-
.map(|i| {
1275-
unsafe { assume(i < n) };
1276-
i
1277-
})
1277+
// // FIXME(#48116/#45964):
1278+
// // This assume() causes misoptimization on LLVM 6.
1279+
// // Commented out until it is fixed again.
1280+
// .map(|i| {
1281+
// unsafe { assume(i < n) };
1282+
// i
1283+
// })
12781284
}
12791285
}
12801286

0 commit comments

Comments
 (0)