-
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.
Remove some
assume
s from slice iterators that don't do anything
- Loading branch information
Showing
2 changed files
with
48 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// no-system-llvm | ||
// compile-flags: -O | ||
// ignore-debug (these add extra checks that make it hard to verify) | ||
#![crate_type = "lib"] | ||
|
||
// The slice iterator used to `assume` that the `start` pointer was non-null. | ||
// That ought to be unneeded, though, since the type is `NonNull`, so this test | ||
// confirms that the appropriate metadata is included to denote that. | ||
|
||
// CHECK-LABEL: @slice_iter_next( | ||
#[no_mangle] | ||
pub fn slice_iter_next<'a>(it: &mut std::slice::Iter<'a, u32>) -> Option<&'a u32> { | ||
// CHECK: %[[ENDP:.+]] = getelementptr{{.+}}ptr %it,{{.+}} 1 | ||
// CHECK: %[[END:.+]] = load ptr, ptr %[[ENDP]] | ||
// CHECK-SAME: !nonnull | ||
// CHECK-SAME: !noundef | ||
// CHECK: %[[START:.+]] = load ptr, ptr %it, | ||
// CHECK-SAME: !nonnull | ||
// CHECK-SAME: !noundef | ||
// CHECK: icmp eq ptr %[[START]], %[[END]] | ||
|
||
// CHECK: store ptr{{.+}}, ptr %it, | ||
|
||
it.next() | ||
} | ||
|
||
// CHECK-LABEL: @slice_iter_next_back( | ||
#[no_mangle] | ||
pub fn slice_iter_next_back<'a>(it: &mut std::slice::Iter<'a, u32>) -> Option<&'a u32> { | ||
// CHECK: %[[ENDP:.+]] = getelementptr{{.+}}ptr %it,{{.+}} 1 | ||
// CHECK: %[[END:.+]] = load ptr, ptr %[[ENDP]] | ||
// CHECK-SAME: !nonnull | ||
// CHECK-SAME: !noundef | ||
// CHECK: %[[START:.+]] = load ptr, ptr %it, | ||
// CHECK-SAME: !nonnull | ||
// CHECK-SAME: !noundef | ||
// CHECK: icmp eq ptr %[[START]], %[[END]] | ||
|
||
// CHECK: store ptr{{.+}}, ptr %[[ENDP]], | ||
|
||
it.next_back() | ||
} |