From 9aa11a128d20c4ce20a447689099df320a89e254 Mon Sep 17 00:00:00 2001 From: LingMan Date: Sat, 10 Apr 2021 18:47:48 +0200 Subject: [PATCH] Add note about reverting a workaround in the future The root cause was fixed upstream in LLVM main. This adds a reminder to revert the workaround once the LLVM rustc depends on is new enough. Since I'm not sure how such optimizations get routed to LLVM releases, I used the conservative assumption that it will only show up with LLVM 13. --- library/core/src/cmp.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index 1dbf47206e4ae..67dd1d83415bd 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -982,6 +982,9 @@ pub trait PartialOrd: PartialEq { #[stable(feature = "rust1", since = "1.0.0")] fn le(&self, other: &Rhs) -> bool { // Pattern `Some(Less | Eq)` optimizes worse than negating `None | Some(Greater)`. + // FIXME: The root cause was fixed upstream in LLVM with: + // https://github.com/llvm/llvm-project/commit/9bad7de9a3fb844f1ca2965f35d0c2a3d1e11775 + // Revert this workaround once support for LLVM 12 gets dropped. !matches!(self.partial_cmp(other), None | Some(Greater)) }