about summary refs log tree commit diff
path: root/tests/codegen
AgeCommit message (Collapse)AuthorLines
2023-01-28Rollup merge of #107373 - ↵Matthias Krüger-0/+8
michaelwoerister:dont-merge-vtables-when-debuginfo, r=WaffleLapkin Don't merge vtables when full debuginfo is enabled. This PR makes the compiler not emit the `unnamed_addr` attribute for vtables when full debuginfo is enabled, so that they don't get merged even if they have the same contents. This allows debuggers to more reliably map from a dyn pointer to the self-type of a trait object by looking at the vtable's debuginfo. The PR only changes the behavior of the LLVM backend as other backends don't emit vtable debuginfo (as far as I can tell). The performance impact of this change should be small as [measured](https://github.com/rust-lang/rust/pull/103514#issuecomment-1290833854) in a previous PR.
2023-01-28Rollup merge of #107022 - scottmcm:ordering-option-eq, r=m-ou-seMatthias Krüger-0/+10
Implement `SpecOptionPartialEq` for `cmp::Ordering` Noticed as I continue to explore options for having code using `partial_cmp` optimize better. Before: ```llvm ; Function Attrs: mustprogress nofree nosync nounwind willreturn uwtable define noundef zeroext i1 `@ordering_eq(i8` noundef %0, i8 noundef %1) unnamed_addr #0 { start: %2 = icmp eq i8 %0, 2 br i1 %2, label %bb1.i, label %bb3.i bb1.i: ; preds = %start %3 = icmp eq i8 %1, 2 br label %"_ZN55_$LT$T$u20$as$u20$core..option..SpecOptionPartialEq$GT$2eq17hb7e7beacecde585fE.exit" bb3.i: ; preds = %start %.not.i = icmp ne i8 %1, 2 %4 = icmp eq i8 %0, %1 %spec.select.i = and i1 %.not.i, %4 br label %"_ZN55_$LT$T$u20$as$u20$core..option..SpecOptionPartialEq$GT$2eq17hb7e7beacecde585fE.exit" "_ZN55_$LT$T$u20$as$u20$core..option..SpecOptionPartialEq$GT$2eq17hb7e7beacecde585fE.exit": ; preds = %bb1.i, %bb3.i %.0.i = phi i1 [ %3, %bb1.i ], [ %spec.select.i, %bb3.i ] ret i1 %.0.i } ``` After: ```llvm ; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn uwtable define noundef zeroext i1 `@ordering_eq(i8` noundef %0, i8 noundef %1) unnamed_addr #1 { start: %2 = icmp eq i8 %0, %1 ret i1 %2 } ``` (Which <https://alive2.llvm.org/ce/z/-rop5r> says LLVM *could* just do itself, but there's probably an issue already open for that problem from when this was originally looked at for `Option<NonZeroU8>` and friends.)
2023-01-27Don't merge vtables when full debuginfo is enabled.Michael Woerister-0/+8
2023-01-22abi: add `AddressSpace` field to `Primitive::Pointer`Erik Desjardins-0/+25
...and remove it from `PointeeInfo`, which isn't meant for this. There are still various places (marked with FIXMEs) that assume all pointers have the same size and alignment. Fixing this requires parsing non-default address spaces in the data layout string, which will be done in a followup.
2023-01-19Auto merge of #106989 - clubby789:is-zero-num, r=scottmcmbors-0/+17
Implement `alloc::vec::IsZero` for `Option<$NUM>` types Fixes #106911 Mirrors the `NonZero$NUM` implementations with an additional `assert_zero_valid`. `None::<i32>` doesn't stricly satisfy `IsZero` but for the purpose of allocating we can produce more efficient codegen.
2023-01-18Implement `SpecOptionPartialEq` for `cmp::Ordering`Scott McMurray-0/+10
2023-01-18Implement `alloc::vec::IsZero` for `Option<$NUM>` typesclubby789-0/+17
2023-01-18Rollup merge of #106995 - lukas-code:align_offset_assembly_test, r=cuviperMatthias Krüger-1/+1
bump failing assembly & codegen tests from LLVM 14 to LLVM 15 These tests need LLVM 15. Found by ```@Robert-Cunningham``` in https://github.com/rust-lang/rust/pull/100601#issuecomment-1385400008 Passed tests at 006506e93fc80318ebfd7939fe1fd4dc19ecd8cb in https://github.com/rust-lang/rust/actions/runs/3942442730/jobs/6746104740.
2023-01-17bump failing assembly & codegen tests from LLVM 14 to LLVM 15Lukas Markeffsky-1/+1
2023-01-17Add more codegen testsNilstrieb-139/+166
2023-01-17Improve commentsNilstrieb-1/+1
2023-01-17Put `noundef` on all scalars that don't allow uninitNilstrieb-174/+174
Previously, it was only put on scalars with range validity invariants like bool, was uninit was obviously invalid for those. Since then, we have normatively declared all uninit primitives to be undefined behavior and can therefore put `noundef` on them. The remaining concern was the `mem::uninitialized` function, which cause quite a lot of UB in the older parts of the ecosystem. This function now doesn't return uninit values anymore, making users of it safe from this change. The only real sources of UB where people could encounter uninit primitives are `MaybeUninit::uninit().assume_init()`, which has always be clear in the docs about being UB and from heap allocations (like reading from the spare capacity of a vec. This is hopefully rare enough to not break anything.
2023-01-15replace manual ptr arithmetic with ptr_subThe 8472-0/+1
2023-01-11Stabilize `abi_efiapi` featureNicholas Bishop-1/+1
Tracking issue: https://github.com/rust-lang/rust/issues/65815
2023-01-11Add a regression test for argument copies with DestinationPropagationBen Kimock-0/+12
2023-01-11Change `src/test` to `tests` in source files, fix tidy and testsAlbert Larsan-3/+3
2023-01-11Move /src/test to /testsAlbert Larsan-0/+14608