Skip to content

Commit efc9725

Browse files
authored
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.
1 parent c417c00 commit efc9725

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

core/src/cmp.rs

+3
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,9 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
982982
#[stable(feature = "rust1", since = "1.0.0")]
983983
fn le(&self, other: &Rhs) -> bool {
984984
// Pattern `Some(Less | Eq)` optimizes worse than negating `None | Some(Greater)`.
985+
// FIXME: The root cause was fixed upstream in LLVM with:
986+
// https://github.com/llvm/llvm-project/commit/9bad7de9a3fb844f1ca2965f35d0c2a3d1e11775
987+
// Revert this workaround once support for LLVM 12 gets dropped.
985988
!matches!(self.partial_cmp(other), None | Some(Greater))
986989
}
987990

0 commit comments

Comments
 (0)