Skip to content

Commit 3b8bd53

Browse files
committed
Auto merge of #48583 - dotdash:jt_assume, r=alexcrichton
Backport LLVM fixes for a JumpThreading / assume intrinsic bug This fixes the original cause of #48116 and restores the assume intrinsic that was removed as a workaround. r? @alexcrichton
2 parents c9b86a9 + 93cfb2a commit 3b8bd53

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

Diff for: src/libcore/slice/mod.rs

+9-15
Original file line numberDiff line numberDiff line change
@@ -1246,18 +1246,15 @@ 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-
// // 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-
// })
1254+
.map(|i| {
1255+
unsafe { assume(i < n) };
1256+
i
1257+
})
12611258
}
12621259

12631260
#[inline]
@@ -1274,13 +1271,10 @@ macro_rules! iterator {
12741271
if predicate(x) { Err(i) }
12751272
else { Ok(i) }
12761273
}).err()
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-
// })
1274+
.map(|i| {
1275+
unsafe { assume(i < n) };
1276+
i
1277+
})
12841278
}
12851279
}
12861280

0 commit comments

Comments
 (0)