Skip to content

Commit

Permalink
Auto merge of #84063 - LingMan:patch-1, r=nagisa
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Apr 11, 2021
2 parents ba6275b + 9aa11a1 commit 58f32da
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions library/core/src/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,9 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
#[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))
}

Expand Down

0 comments on commit 58f32da

Please sign in to comment.