about summary refs log tree commit diff
path: root/tests/codegen
AgeCommit message (Collapse)AuthorLines
2024-05-28Make more of the test suite run on Mac CatalystMads Marquart-9/+8
This adds the `only-apple`/`ignore-apple` compiletest directive, and uses that basically everywhere instead of `only-macos`/`ignore-macos`. Some of the updates in `run-make` are a bit redundant, as they use `ignore-cross-compile` and won't run on iOS - but using Apple in these is still more correct, so I've made that change anyhow.
2024-05-27Omit non-needs_drop drop_in_place in vtablesMark Rousskov-0/+16
This replaces the drop_in_place reference with null in vtables. On librustc_driver.so, this drops about ~17k dynamic relocations from the output, since many vtables can now be placed in read-only memory, rather than having a relocated pointer included. This makes a tradeoff by adding a null check at vtable call sites. That's hard to avoid without changing the vtable format (e.g., to use a pc-relative relocation instead of an absolute address, and avoid the dynamic relocation that way). But it seems likely that the check is cheap at runtime.
2024-05-23Rollup merge of #125222 - Oneirical:fifth, r=jieyouxuMatthias Krüger-0/+21
Migrate `run-make/issue-46239` to `rmake` Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).
2024-05-22rewrite and rename issue-46239Oneirical-0/+21
2024-05-21Auto merge of #125298 - tesuji:arrcmp, r=nikicbors-0/+18
Add codegen test for array comparision opt Fixed since rust 1.55 closes #62531
2024-05-21Add codegen test for array comparision optLzu Tao-0/+18
2024-05-20add codegen test for issue 120493Joshua Wong-0/+22
2024-05-18Rollup merge of #125184 - scottmcm:fix-thin-ptr-ice, r=jieyouxuMatthias Krüger-0/+23
Fix ICE in non-operand `aggregate_raw_ptr` intrinsic codegen Introduced in #123840 Found in #121571, cc `@clarfonthey`
2024-05-16Fix ICE in non-operand `aggregate_raw_ptr` instrinsic codegenScott McMurray-0/+23
2024-05-16Fix assertion when attempting to convert `f16` and `f128` with `as`Trevor Gross-3/+393
These types are currently rejected for `as` casts by the compiler. Remove this incorrect check and add codegen tests for all conversions involving these types.
2024-05-11Unify `Rvalue::Aggregate` paths in cg_ssaScott McMurray-1/+1
2024-05-11fix few typo in filecheck annotationsklensy-8/+8
2024-05-08Make SSA aggregates without needing an allocaScott McMurray-15/+99
2024-05-08Add a codegen test for transparent aggregatesScott McMurray-0/+39
2024-05-06Adjust dbg.value/dbg.declare checks for LLVM updateArthur Eubanks-10/+10
https://github.com/llvm/llvm-project/pull/89799 changes llvm.dbg.value/declare intrinsics to be in a different, out-of-instruction-line representation. For example call void @llvm.dbg.declare(...) becomes #dbg_declare(...) Update tests accordingly to work with both the old and new way.
2024-05-04tests/ui: prepare some tests for --check-cfg by defaultUrgau-9/+6
2024-05-03Add -Zfixed-x18Alice Ryhl-0/+22
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
2024-05-01Add inline comments why we're forcing the target cpuJosh Stone-0/+1
2024-05-01Use an explicit x86-64 cpu in tests that are sensitive to itJosh Stone-1/+1
There are a few tests that depend on some target features **not** being enabled by default, and usually they are correct with the default x86-64 target CPU. However, in downstream builds we have modified the default to fit our distros -- `x86-64-v2` in RHEL 9 and `x86-64-v3` in RHEL 10 -- and the latter especially trips tests that expect not to have AVX. These cases are few enough that we can just set them back explicitly.
2024-04-30Rollup merge of #124543 - maurer:llvm-range, r=nikicMatthias Krüger-3/+3
codegen tests: Tolerate `range()` qualifications in enum tests Current LLVM can infer range bounds on the i8s involved with these tests, and annotates it. Accept these bounds if present. `@rustbot` label: +llvm-main cc `@durin42`
2024-04-30codegen tests: Tolerate `range()` qualifications in enum testsMatthew Maurer-3/+3
Current LLVM can infer range bounds on the i8s involved with these tests, and annotates it. Accept these bounds if present.
2024-04-29adapt a codegen test for llvm 19Krasimir Georgiev-3/+3
No functional changes intended. Found by our experimental rust + LLVM @ HEAD bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/27747#018f2570-018c-4b12-9c5a-38cf81453683/957-965
2024-04-25Auto merge of #121298 - nikic:writable, r=cuviperbors-4/+6
Set writable and dead_on_unwind attributes for sret arguments Set the `writable` and `dead_on_unwind` attributes for `sret` arguments. This allows call slot optimization to remove more memcpy's. See https://llvm.org/docs/LangRef.html#parameter-attributes for the specification of these attributes. In short, the statement we're making here is that: * The return slot is writable. * The return slot will not be read if the function unwinds. Fixes https://github.com/rust-lang/rust/issues/90595.
2024-04-25Add needs-unwind to codegen testNikita Popov-0/+1
When compiled with -C panic=abort we'd generate an extra panic_cannot_unwind shim in the variant calling C-unwind.
2024-04-25Fix incorrect CHECK-LABELNikita Popov-1/+1
2024-04-25Set writable and dead_on_unwind attributes for sret argumentsNikita Popov-3/+4
2024-04-24Fix tests and blessGary Guo-6/+1
2024-04-24Error on using `yield` without also using `#[coroutine]` on the closureOli Scherer-2/+2
And suggest adding the `#[coroutine]` to the closure
2024-04-24Auto merge of #122053 - erikdesjardins:alloca, r=nikicbors-108/+174
Stop using LLVM struct types for alloca The alloca type has no semantic meaning, only the size (and alignment, but we specify it explicitly) matter. Using `[N x i8]` is a more direct way to specify that we want `N` bytes, and avoids relying on LLVM's struct layout. It is likely that a future LLVM version will change to an untyped alloca representation. Split out from #121577. r? `@ghost`
2024-04-23Rollup merge of #124003 - WaffleLapkin:dellvmization, r=scottmcm,RalfJung,antoyoMatthias Krüger-0/+118
Dellvmize some intrinsics (use `u32` instead of `Self` in some integer intrinsics) This implements https://github.com/rust-lang/compiler-team/issues/693 minus what was implemented in #123226. Note: I decided to _not_ change `shl`/... builder methods, as it just doesn't seem worth it. r? ``@scottmcm``
2024-04-23add codegen testTrevor Spiteri-0/+20
The test confirms that when val < base, we do not divide or multiply.
2024-04-22Stabilize generic `NonZero`.Markus Reiter-10/+1
2024-04-20Avoid reloading Vec::len across grow_one in pushMark Rousskov-0/+16
This saves an extra load from memory.
2024-04-18Make `checked` ops emit *unchecked* LLVM operations where feasibleScott McMurray-0/+86
For things with easily pre-checked overflow conditions -- shifts and unsigned subtraction -- write then checked methods in such a way that we stop emitting wrapping versions of them. For example, today <https://rust.godbolt.org/z/qM9YK8Txb> neither ```rust a.checked_sub(b).unwrap() ``` nor ```rust a.checked_sub(b).unwrap_unchecked() ``` actually optimizes to `sub nuw`. After this PR they do.
2024-04-18At debuginfo=0, don't inline debuginfo when inliningScott McMurray-18/+20
2024-04-16Add codegen tests for changed intrinsicsMaybe Waffle-0/+118
2024-04-15Auto merge of #122917 - saethlin:atomicptr-to-int, r=nikicbors-0/+38
Add the missing inttoptr when we ptrtoint in ptr atomics Ralf noticed this here: https://github.com/rust-lang/rust/pull/122220#discussion_r1535172094 Our previous codegen forgot to add the cast back to integer type. The code compiles anyway, because of course all locals are in-memory to start with, so previous codegen would do the integer atomic, store the integer to a local, then load a pointer from that local. Which is definitely _not_ what we wanted: That's an integer-to-pointer transmute, so all pointers returned by these `AtomicPtr` methods didn't have provenance. Yikes. Here's the IR for `AtomicPtr::fetch_byte_add` on 1.76: https://godbolt.org/z/8qTEjeraY ```llvm define noundef ptr `@atomicptr_fetch_byte_add(ptr` noundef nonnull align 8 %a, i64 noundef %v) unnamed_addr #0 !dbg !7 { start: %0 = alloca ptr, align 8, !dbg !12 %val = inttoptr i64 %v to ptr, !dbg !12 call void `@llvm.lifetime.start.p0(i64` 8, ptr %0), !dbg !28 %1 = ptrtoint ptr %val to i64, !dbg !28 %2 = atomicrmw add ptr %a, i64 %1 monotonic, align 8, !dbg !28 store i64 %2, ptr %0, align 8, !dbg !28 %self = load ptr, ptr %0, align 8, !dbg !28 call void `@llvm.lifetime.end.p0(i64` 8, ptr %0), !dbg !28 ret ptr %self, !dbg !33 } ``` r? `@RalfJung` cc `@nikic`
2024-04-12Rollup merge of #123249 - goolmoos:naked_variadics, r=pnkfelixMatthias Krüger-1/+20
do not add prolog for variadic naked functions fixes #99858
2024-04-12remove alloca type from issue-105386-ub-in-debuginfoErik Desjardins-1/+1
It's irrelevant for the purposes of this test (there is only one alloca) and its size changes depending on the target, so it can't be matched easily.
2024-04-12do not add prolog for variadic naked functionsGuy Shefy-1/+20
fixes #99858
2024-04-11use [N x i8] for alloca typesErik Desjardins-108/+174
2024-04-11codegen tests: Tolerate `nuw` `nsw` on `trunc`Matthew Maurer-5/+5
llvm/llvm-project#87910 infers `nuw` and `nsw` on some `trunc` instructions we're doing `FileCheck` on. Tolerate but don't require them to support both release and head LLVM.
2024-04-11Rollup merge of #122470 - tgross35:f16-f128-step4-libs-min, r=AmanieuLeón Orell Valerian Liehr-0/+258
`f16` and `f128` step 4: basic library support This is the next step after https://github.com/rust-lang/rust/pull/121926, another portion of https://github.com/rust-lang/rust/pull/114607 Tracking issue: https://github.com/rust-lang/rust/issues/116909 This PR adds the most basic operations to `f16` and `f128` that get lowered as LLVM intrinsics. This is a very small step but it seemed reasonable enough to add unopinionated basic operations before the larger modules that are built on top of them. r? ```@Amanieu``` since you were pretty involved in the RFC cc ```@compiler-errors``` ```@rustbot``` label +T-libs-api +S-blocked +F-f16_and_f128
2024-04-10Add basic library support for `f16` and `f128`Trevor Gross-0/+258
Implement basic operation traits that get lowered to intrinsics. This includes codegen tests for implemented operations.
2024-04-10Auto merge of #123185 - scottmcm:more-typed-copy, r=compiler-errorsbors-37/+60
Remove my `scalar_copy_backend_type` optimization attempt I added this back in https://github.com/rust-lang/rust/pull/111999 , but I no longer think it's a good idea - It had to get scaled back to only power-of-two things to not break a bunch of targets - LLVM seems to be getting better at memcpy removal anyway - Introducing vector instructions has seemed to sometimes (https://github.com/rust-lang/rust/pull/115515#issuecomment-1750069529) make autovectorization worse So this removes it from the codegen crates entirely, and instead just tries to use <https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/traits/builder/trait.BuilderMethods.html#method.typed_place_copy> instead of direct `memcpy` so things will still use load/store when a type isn't `OperandValue::Ref`.
2024-04-10Update 122805 test for PR 123185Scott McMurray-10/+29
2024-04-10Rollup merge of #123612 - kxxt:riscv-target-abi, r=jieyouxu,nikic,DianQKMatthias Krüger-0/+20
Set target-abi module flag for RISC-V targets Fixes cross-language LTO on RISC-V targets (Fixes #121924)
2024-04-09Remove my `scalar_copy_backend_type` optimization attemptScott McMurray-27/+31
I added this back in 111999, but I no longer think it's a good idea - It had to get scaled back to only power-of-two things to not break a bunch of targets - LLVM seems to be getting better at memcpy removal anyway - Introducing vector instructions has seemed to sometimes (115515) make autovectorization worse So this removes it from the codegen crates entirely, and instead just tries to use <https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/traits/builder/trait.BuilderMethods.html#method.typed_place_copy> instead of direct `memcpy` so things will still use load/store for immediates.
2024-04-09Set target-abi module flag for RISC-V targetskxxt-0/+20
Fixes cross-language LTO on RISC-V targets (Fixes #121924)
2024-04-09Auto merge of #122387 - DianQK:re-enable-early-otherwise-branch, r=cjgillotbors-0/+26
Re-enable the early otherwise branch optimization Closes #95162. Fixes #119014. This is the first part of #121397. An invalid enum discriminant can come from anywhere. We have to check to see if all successors contain the discriminant statement. This should have a pass to hoist instructions. r? cjgillot