Matthias Krüger 273fbf47ab
Rollup merge of #111282 - scottmcm:remove-unneeded-assumes, r=workingjubilee
Remove some `assume`s from slice iterators that don't do anything

Because the start pointer is iterators is already a `NonNull`, we emit the appropriate `!nonnull` metadata when loading the pointer to tell LLVM that it's non-null.

Probably the best way to see that it's the metadata that's important (and not the `assume`) is to observe that LLVM actually *removes* the `assume` from the optimized IR: <https://rust.godbolt.org/z/KhE6G963n>.

(I also checked that, yes, the if-not-ZST `assume` on `end` is still doing something: it's how there's a `!nonnull` metadata on its load, even though it's an ordinary raw pointer.  The codegen test added in this PR fails if the other `assume` is  removed.)
2023-05-09 20:49:33 +02:00
..
2023-03-20 10:25:29 +00:00
2023-01-17 16:23:22 +01:00
2023-04-28 23:08:54 +02:00
2023-01-11 20:42:13 -05:00
2023-01-17 16:23:22 +01:00
2023-01-17 16:23:22 +01:00
2023-03-16 15:07:04 +01:00
2023-05-03 22:09:33 -07:00
2023-01-17 16:23:22 +01:00
2023-04-14 16:26:11 +00:00
2023-05-08 03:55:41 -07:00
2023-01-17 16:23:22 +01:00
2023-04-30 00:06:26 +08:00
2023-01-17 16:23:22 +01:00
2023-05-08 03:55:41 -07:00
2023-02-14 19:21:58 -05:00
2023-01-17 16:23:22 +01:00
2023-05-08 03:55:41 -07:00
2023-04-17 09:16:07 +02:00
2023-01-17 16:23:22 +01:00
2023-01-17 16:23:22 +01:00
2023-01-17 16:23:22 +01:00
2023-01-17 16:23:22 +01:00
2023-02-14 19:21:58 -05:00
2023-01-17 16:23:22 +01:00
2023-05-08 03:55:41 -07:00
2023-05-07 12:38:47 +01:00
2023-01-17 16:23:22 +01:00

The files here use the LLVM FileCheck framework, documented at https://llvm.org/docs/CommandGuide/FileCheck.html.

One extension worth noting is the use of revisions as custom prefixes for FileCheck. If your codegen test has different behavior based on the chosen target or different compiler flags that you want to exercise, you can use a revisions annotation, like so:

// revisions: aaa bbb
// [bbb] compile-flags: --flags-for-bbb

After specifying those variations, you can write different expected, or explicitly unexpected output by using <prefix>-SAME: and <prefix>-NOT:, like so:

// CHECK: expected code
// aaa-SAME: emitted-only-for-aaa
// aaa-NOT:                        emitted-only-for-bbb
// bbb-NOT:  emitted-only-for-aaa
// bbb-SAME:                       emitted-only-for-bbb