about summary refs log tree commit diff
path: root/tests/codegen
AgeCommit message (Collapse)AuthorLines
2023-04-18Rollup merge of #110441 - kadiwa4:typos, r=thomccGuillaume Gomez-1/+1
5 little typos
2023-04-18Auto merge of #110242 - cuviper:vanilla-llvm-16, r=Mark-Simulacrumbors-0/+2
ci: add a runner for vanilla LLVM 16 Like #107044, this will let us track compatibility with LLVM 16 going forward, especially after we eventually upgrade our own to the next. This also drops `tidy` here and in `x86_64-gnu-llvm-15`, syncing with that change in #106085.
2023-04-17Rollup merge of #110455 - durin42:tls-D148269-fix, r=nikicMatthias Krüger-4/+4
tests: adapt for LLVM change 5b386b864c7619897c51a1da97d78f1cf6f3eff6 The above-mentioned change modified the output of thread-local.rs by changing some variable names. Rather than assume things get put in %0, we capture the variable so the test passes in both the old and new version.
2023-04-17Rollup merge of #110313 - fee1-dead-contrib:repr_align_method, r=WaffleLapkinMatthias Krüger-0/+40
allow `repr(align = x)` on inherent methods Discussion: https://github.com/rust-lang/rust/issues/82232#issuecomment-905929314
2023-04-17tests: adapt for LLVM change 5b386b864c7619897c51a1da97d78f1cf6f3eff6Augie Fackler-4/+4
The above-mentioned change modified the output of thread-local.rs by changing some variable names. Rather than assume things get put in %0, we capture the variable so the test passes in both the old and new version.
2023-04-17typoskadiwa-1/+1
2023-04-17Auto merge of #109247 - saethlin:inline-without-inline, r=oli-obkbors-5/+7
Permit MIR inlining without #[inline] I noticed that there are at least a handful of portable-simd functions that have no `#[inline]` but compile to an assign + return. I locally benchmarked inlining thresholds between 0 and 50 in increments of 5, and 50 seems to be the best. Interesting. That didn't include check builds though, ~maybe perf will have something to say about that~. Perf has little useful to say about this. We generally regress all the check builds, as best as I can tell, due to a number of small codegen changes in a particular hot function in the compiler. Probably this is because we've nudged the inlining outcomes all over, and uses of `#[inline(always)]`/`#[inline(never)]` might need to be adjusted.
2023-04-16ci: add a runner for vanilla LLVM 16Josh Stone-0/+2
Like #107044, this will let us track compatibility with LLVM 16 going forward, especially after we eventually upgrade our own to the next. This also drops `tidy` here and in `x86_64-gnu-llvm-15`, syncing with that change in #106085.
2023-04-16Allow all associated functions and add testDeadbeef-0/+31
2023-04-15Bless codegen test.Camille GILLOT-3/+0
2023-04-14Update codegen test.Camille GILLOT-2/+5
2023-04-14allow `repr(align = x)` on inherent methodsDeadbeef-0/+9
2023-04-13Auto merge of #109466 - davidlattimore:inline-arg-via-var-debug-info, ↵bors-0/+20
r=wesleywiser Preserve argument indexes when inlining MIR We store argument indexes on VarDebugInfo. Unlike the previous method of relying on the variable index to know whether a variable is an argument, this survives MIR inlining. We also no longer check if var.source_info.scope is the outermost scope. When a function gets inlined, the arguments to the inner function will no longer be in the outermost scope. What we care about though is whether they were in the outermost scope prior to inlining, which we know by whether we assigned an argument index. Fixes #83217 I considered using `Option<NonZeroU16>` instead of `Option<u16>` to store the index. I didn't because `TypeFoldable` isn't implemented for `NonZeroU16` and because it looks like due to padding, it currently wouldn't make any difference. But I indexed from 1 anyway because (a) it'll make it easier if later it becomes worthwhile to use a `NonZeroU16` and because the arguments were previously indexed from 1, so it made for a smaller change. This is my first PR on rust-lang/rust, so apologies if I've gotten anything not quite right.
2023-04-12Auto merge of #109895 - nikic:llvm-16-tests, r=cuviperbors-0/+118
Add codegen tests for issues fixed by LLVM 16 Fixes #75978. Fixes #99960. Fixes #101048. Fixes #101082. Fixes #101814. Fixes #103132. Fixes #103327.
2023-04-11Make test compatible with 32-bitNikita Popov-1/+1
2023-04-11Add ignore-debug to two testsNikita Popov-0/+2
These don't optimize with debug assertions. For one of them, this is due to the new alignment checks, for the other I'm not sure what specifically blocks it.
2023-04-11Preserve argument indexes when inlining MIRDavid Lattimore-0/+20
We store argument indexes on VarDebugInfo. Unlike the previous method of relying on the variable index to know whether a variable is an argument, this survives MIR inlining. We also no longer check if var.source_info.scope is the outermost scope. When a function gets inlined, the arguments to the inner function will no longer be in the outermost scope. What we care about though is whether they were in the outermost scope prior to inlining, which we know by whether we assigned an argument index.
2023-04-09Handle not all immediates having `abi::Scalar`sScott McMurray-1/+92
2023-04-07Give the cross-crate generic some work to doBen Kimock-2/+4
2023-04-07Permit MIR inlining without #[inline]Ben Kimock-3/+3
2023-04-06Check `CastKind::Transmute` sizes in a better wayScott McMurray-1/+73
Fixes #110005
2023-04-05Auto merge of #107925 - thomcc:sip13, r=cjgillotbors-4/+4
Use SipHash-1-3 instead of SipHash-2-4 for StableHasher Noticed this, and it seems easy and likely a perf win. IIUC we don't need DDOS resistance (just collision) so we ideally would have an even faster hash, but it's hard to beat this SipHash impl here, since it's been so highly tuned for the interface. It wouldn't surprise me if there's some subtle reason changing this sucks, as it's so obvious it seems likely to have been done. Still, SipHash-1-3 seems to still have the guarantees StableHasher should need (and seemingly more), and is clearly less work. So it's worth a shot. Not fully tested locally.
2023-04-05Auto merge of #108905 - ferrocene:pa-compiletest-ignore, r=ehussbors-76/+13
Validate `ignore` and `only` compiletest directive, and add human-readable ignore reasons This PR adds strict validation for the `ignore` and `only` compiletest directives, failing if an unknown value is provided to them. Doing so uncovered 79 tests in `tests/ui` that had invalid directives, so this PR also fixes them. Finally, this PR adds human-readable ignore reasons when tests are ignored due to `ignore` or `only` directives, like *"only executed when the architecture is aarch64"* or *"ignored when the operative system is windows"*. This was the original reason why I started working on this PR and #108659, as we need both of them for Ferrocene. The PR is a draft because the code is extremely inefficient: it calls `rustc --print=cfg --target $target` for every rustc target (to gather the list of allowed ignore values), which on my system takes between 4s and 5s, and performs a lot of allocations of constant values. I'll fix both of them in the coming days. r? `@ehuss`
2023-04-05Fix codegen tests with hard-coded hashesRémy Rakic-2/+2
2023-04-05Fix a codegen test with some hard-coded hashesThom Chiovoloni-2/+2
2023-04-05Auto merge of #109843 - scottmcm:better-transmute, r=WaffleLapkinbors-54/+194
Allow `transmute`s to produce `OperandValue`s instead of needing `alloca`s LLVM can usually optimize these away, but especially for things like transmutes of newtypes it's silly to generate the `alloc`+`store`+`load` at all when it's actually a nop at LLVM level.
2023-04-04Allow `transmute`s to produce `OperandValue`s instead of always using `alloca`sScott McMurray-54/+194
LLVM can usually optimize these away, but especially for things like transmutes of newtypes it's silly to generate the `alloc`+`store`+`load` at all when it's actually a nop at LLVM level.
2023-04-04Auto merge of #109808 - jyn514:debuginfo-options, r=michaelwoeristerbors-0/+81
Extend -Cdebuginfo with new options and named aliases This is a rebase of https://github.com/rust-lang/rust/pull/83947, along with my best guess at what the new options mean. I tried to follow the LLVM source code to get a better idea but ran into quite a lot of trouble (https://rust-lang.zulipchat.com/#narrow/stream/187780-t-compiler.2Fwg-llvm/topic/go-to-definition.20in.20src.2Fllvm-project.3F). The description for the original PR follows below. Note that the changes in this PR have already been through FCP: https://github.com/rust-lang/rust/pull/83947#issuecomment-878384979 Closes https://github.com/rust-lang/rust/pull/109311. Helps with https://github.com/rust-lang/rust/pull/104968. r? `@michaelwoerister` cc `@cuviper` --- The -Cdebuginfo=1 option was never line tables only and can't be due to backwards compatibility issues. This was clarified and an option for emitting line tables only was added. Additionally an option for emitting line info directives only was added, which is needed for some targets, i.e. nvptx. The debug info options should now behave similarly to clang's debug info options. Fix https://github.com/rust-lang/rust/issues/60020 Fix https://github.com/rust-lang/rust/issues/64405
2023-04-03Add codegen tests for issues fixed by LLVM 16Nikita Popov-0/+116
Fixes #75978. Fixes #99960. Fixes #101048. Fixes #101082. Fixes #101814. Fixes #103132. Fixes #103327.
2023-04-03llvm 16 finally reconizes some additional vec in-place conversions as noopsThe 8472-11/+31
2023-04-03remove unknown xcore archPietro Albini-1/+0
2023-04-03make 32bit ignore more accuratePietro Albini-5/+1
2023-04-03remove a bunch of unknown archs from the global_asm testsPietro Albini-66/+12
2023-04-03remove invalid ignore-powerpc64lePietro Albini-4/+0
2023-03-31More in-depth documentation for the new debuginfo optionsJulia Tatz-9/+6
2023-03-31Preserve, clarify, and extend debug informationJulia Tatz-0/+84
`-Cdebuginfo=1` was never line tables only and can't be due to backwards compatibility issues. This was clarified and an option for line tables only was added. Additionally an option for line info directives only was added, which is well needed for some targets. The debug info options should now behave the same as clang's debug info options.
2023-03-31Auto merge of #98112 - saethlin:mir-alignment-checks, r=oli-obkbors-0/+2
Insert alignment checks for pointer dereferences when debug assertions are enabled Closes https://github.com/rust-lang/rust/issues/54915 - [x] Jake tells me this sounds like a place to use `MirPatch`, but I can't figure out how to insert a new basic block with a new terminator in the middle of an existing basic block, using `MirPatch`. (if nobody else backs up this point I'm checking this as "not actually a good idea" because the code looks pretty clean to me after rearranging it a bit) - [x] Using `CastKind::PointerExposeAddress` is definitely wrong, we don't want to expose. Calling a function to get the pointer address seems quite excessive. ~I'll see if I can add a new `CastKind`.~ `CastKind::Transmute` to the rescue! - [x] Implement a more helpful panic message like slice bounds checking. r? `@oli-obk`
2023-03-27update codegen test expectationsRémy Rakic-2/+2
Changing the layout of the InitMask changed the const allocations' hashes.
2023-03-25Auto merge of #109474 - nikic:llvm-16-again, r=cuviperbors-3/+3
Upgrade to LLVM 16, again Relative to the previous attempt in https://github.com/rust-lang/rust/pull/107224: * Update to GCC 8.5 on dist-x86_64-linux, to avoid std::optional ABI-incompatibility between libstdc++ 7 and 8. * Cherry-pick https://github.com/llvm/llvm-project/commit/96df79af029b85616ab90e73143e0e8ae89c7b46. * Cherry-pick https://github.com/llvm/llvm-project/commit/6fc670e5e370e90759b5adecd9980b63609dc2f8. r? `@cuviper`
2023-03-24Auto merge of #109220 - nikic:poison, r=cuviperbors-1/+1
Use poison instead of undef In cases where it is legal, we should prefer poison values over undef values. This replaces undef with poison for aggregate construction and for uninhabited types. There are more places where we can likely use poison, but I wanted to stay conservative to start with. In particular the aggregate case is important for newer LLVM versions, which are not able to handle an undef base value during early optimization due to poison-propagation concerns. r? `@cuviper`
2023-03-23A MIR transform that checks pointers are alignedBen Kimock-0/+2
2023-03-23Auto merge of #108442 - scottmcm:mir-transmute, r=oli-obkbors-27/+210
Add `CastKind::Transmute` to MIR ~~Nothing actually produces it in this commit, so I don't know how to test it, but it also means it shouldn't be possible for it to break anything.~~ Includes lowering `transmute` calls to it, so it's used. Zulip Conversation: <https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/Good.20first.20isssue/near/321849610>
2023-03-23Auto merge of #109172 - scottmcm:move-codegen-issues-tests, r=WaffleLapkinbors-0/+0
mv tests/codegen/issue-* tests/codegen/issues/ No changes to the contents; just a move. Like how there's a <https://github.com/rust-lang/rust/tree/master/tests/ui/issues> folder.
2023-03-22Add `CastKind::Transmute` to MIRScott McMurray-27/+210
Updates `interpret`, `codegen_ssa`, and `codegen_cranelift` to consume the new cast instead of the intrinsic. Includes `CastTransmute` for custom MIR building, to be able to test the extra UB.
2023-03-22Rollup merge of #109394 - krasimirgg:llvm-17-vec-panic, r=nikicMatthias Krüger-9/+14
adapt tests/codegen/vec-shrink-panik for LLVM 17 After https://github.com/llvm/llvm-project/commit/0d4a709bb876824a0afa5f86e138e8ffdcaf7661 LLVM now doesn't generate references to panic_cannot_unwind: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/17978#0186ff55-ca6f-4bc5-b1ec-2622c77d0ed5/744-746 Adapted as suggested by ````@nikic```` on Zulip: https://rust-lang.zulipchat.com/#narrow/stream/187780-t-compiler.2Fwg-llvm/topic/a.20couple.20codegen.20test.20failures.20after.20llvm.200d4a709bb876824a/near/342664944 >Okay, so LLVM now realizes that double panic is not possible, so that's fine.
2023-03-22Increase array size in array-map.rsNikita Popov-3/+3
Make sure that the loop is not fully unrolled (which allows eliminating the allocas) in LLVM 16 either.
2023-03-21Auto merge of #106967 - saethlin:remove-vec-as-ptr-assume, r=thomccbors-0/+19
Remove the assume(!is_null) from Vec::as_ptr At a guess, this code is leftover from LLVM was worse at keeping track of the niche information here. In any case, we don't need this anymore: Removing this `assume` doesn't get rid of the `nonnull` attribute on the return type.
2023-03-20adapt tests/codegen/vec-shrink-panik for LLVM 17Krasimir Georgiev-9/+14
After https://github.com/llvm/llvm-project/commit/0d4a709bb876824a0afa5f86e138e8ffdcaf7661 LLVM now doesn't generate references to panic_cannot_unwind: @nikic: https://rust-lang.zulipchat.com/#narrow/stream/187780-t-compiler.2Fwg-llvm/topic/a.20couple.20codegen.20test.20failures.20after.20llvm.200d4a709bb876824a/near/342664944 >Okay, so LLVM now realizes that double panic is not possible, so that's fine.
2023-03-20Also move the auxiliary fileScott McMurray-0/+0
2023-03-20mv tests/codegen/issue-* tests/codegen/issues/Scott McMurray-0/+0