From f05d9679d708ccd1a6a643838bbf3a64ccf271bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Steinbrink?= Date: Tue, 27 Feb 2018 14:20:13 +0100 Subject: [PATCH 1/2] Backport LLVM fixes for a JumpThreading / assume intrinsic bug --- src/libcore/slice/mod.rs | 24 +++++++++--------------- src/llvm | 2 +- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index ac390313a6797..aacbbd5058e05 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -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 + }) } } diff --git a/src/llvm b/src/llvm index 9f81beaf32608..5c6b7fea4a302 160000 --- a/src/llvm +++ b/src/llvm @@ -1 +1 @@ -Subproject commit 9f81beaf32608fbe1fe0f2a82f974e800e9d8c62 +Subproject commit 5c6b7fea4a302261f18b1cc6ea22b2a9eec2abd9 From 93cfb2abfd22c5ce106f51c5e40c31fed10e4756 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 28 Feb 2018 13:21:14 -0800 Subject: [PATCH 2/2] Update LLVM submodule a bit further --- src/llvm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/llvm b/src/llvm index 5c6b7fea4a302..ba2edd794c7de 160000 --- a/src/llvm +++ b/src/llvm @@ -1 +1 @@ -Subproject commit 5c6b7fea4a302261f18b1cc6ea22b2a9eec2abd9 +Subproject commit ba2edd794c7def715007931fcd1b4ce62aa711c8