-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #61885 - scottmcm:slice-iter-len-opt, r=rkruppe,RalfJung
Help LLVM better optimize slice::Iter(Mut)::len r? @RalfJung I've included a codegen test that fails without this change as a demonstration of usefulness.
- Loading branch information
Showing
3 changed files
with
37 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// no-system-llvm | ||
// compile-flags: -O | ||
#![crate_type = "lib"] | ||
|
||
type Demo = [u8; 3]; | ||
|
||
// CHECK-LABEL: @slice_iter_len_eq_zero | ||
#[no_mangle] | ||
pub fn slice_iter_len_eq_zero(y: std::slice::Iter<'_, Demo>) -> bool { | ||
// CHECK-NOT: sub | ||
// CHECK: %2 = icmp eq i8* %1, %0 | ||
// CHECK: ret i1 %2 | ||
y.len() == 0 | ||
} |