about summary refs log tree commit diff
path: root/src/test/codegen
AgeCommit message (Collapse)AuthorLines
2019-06-17Expose `VaListImpl` as the Rust equivalent of `__va_list_tag` and implement ↵Andrei Homescu-3/+30
Clone for it.
2019-06-17Rollup merge of #61885 - scottmcm:slice-iter-len-opt, r=rkruppe,RalfJungMazdak Farrokhzad-0/+14
Help LLVM better optimize slice::Iter(Mut)::len r? @RalfJung I've included a codegen test that fails without this change as a demonstration of usefulness.
2019-06-15Help LLVM better optimize slice::Iter(Mut)::lenScott McMurray-0/+14
2019-06-13Create fewer basic blocks in match MIR loweringMatthew Jasper-2/+2
2019-06-11Rollup merge of #61526 - lcnr:test_reorder, r=nikomatsakisMazdak Farrokhzad-2/+2
move some tests into subfolders This reduces the size of the test folders without making the moved tests harder to find. Is this kind of change desired/worth the effort?
2019-06-10Implement RFC 2645 (transparent enums and unions)Michael Bradshaw-28/+190
Tracking issue: #60405
2019-06-09Auto merge of #61229 - Centril:stabilize-repr_align_enum, r=nagisabors-1/+0
Stabilize #![feature(repr_align_enum)] in Rust 1.37.0 On an `enum` item, you may now write: ```rust #[repr(align(X))] enum Foo { // ... } ``` This has equivalent effects to first defining: ```rust #[repr(align(X))] struct AlignX<T>(T); ``` and then using `AlignX<Foo>` in `Foo`'s stead. r? @nagisa
2019-06-08Turn `#[allocator]` into a built-in attribute and rename it to ↵Vadim Petrochenkov-2/+2
`#[rustc_allocator]`
2019-06-04improve test indentationlcnr/Bastian Kauschke-2/+2
2019-06-04move intrinsics codegen tests into a seperate folderlcnr/Bastian Kauschke-0/+0
2019-06-03add codegen test for unchecked mathlcnr/Bastian Kauschke-0/+46
2019-05-31test: support both (`legacy` and `v0`) choices of mangling.Eduard-Mihai Burtescu-17/+38
2019-05-28Make test/codegen/pgo-instrumentation.rs work reliably on Windows.Michael Woerister-4/+7
2019-05-27Stabilize repr_align_enum in 1.37.0.Mazdak Farrokhzad-1/+0
2019-05-20stabilize core parts of MaybeUninit and deprecate mem::uninitialized in the ↵Ralf Jung-1/+0
future Also expand the documentation a bit
2019-05-18Auto merge of #60386 - Goirad:sgx-ignore-tests, r=nikomatsakisbors-0/+2
Added ignore-sgx for appropriate tests in src/test These are all the tests that make sense to ignore when targeting fortanix-unknonw-sgx, at least in test/runpass. Other suites not yet covered.
2019-05-17Auto merge of #60171 - matthewjasper:full-nll-compare-mode, r=pnkfelixbors-1/+0
Use -Zborrowck=mir for NLL compare mode closes #56993 r? @pnkfelix
2019-05-16Added ignore-sgx for appropriate testsDario Gonzalez-0/+2
2019-05-15Auto merge of #60775 - hellow554:no_bitrig, r=joshtriplettbors-2/+0
Remove bitrig support from rust Resolves #60743 using `find` and `rg` I delete every occurence of "bitrig" in the sources, expect for the llvm submodule (is this correct?). There's also this file https://github.com/rust-lang/rls/blob/5b8e99bb61958ca8abcb7c5eda70521726be1065/rls-analysis/test_data/rust-analysis/libstd-af9bacceee784405.json which contains a bitrig string in it. What to do with that?
2019-05-13default to $ARCH-apple-macosx10.7.0 LLVM triple for darwin targetsNathan Froyd-2/+2
Over in #60378, we made `rustc` switch LLVM target triples dynamically based on the `MACOSX_DEPLOYMENT_TARGET` environment variable. This change was made to align with `clang`'s behavior, and therefore make cross-language LTO feasible on OS X. Otherwise, `rustc` would produce LLVM bitcode files with a target triple of `x86_64-apple-darwin`, `clang` would produce LLVM bitcode files with a target triple of `x86_64-apple-macosx$VERSION`, and the linker would complain. This change worked fine, except for one corner case: if you didn't have `MACOSX_DEPLOYMENT_TARGET` set, and you wanted to do LTO on just Rust code, you'd get warning messages similar to: ``` warning: Linking two modules of different target triples: ' is 'x86_64-apple-macosx10.7.0' whereas 'main.7rcbfp3g-cgu.4' is 'x86_64-apple-darwin' ``` This message occurs because libstd is compiled with `MACOSX_DEPLOYMENT_TARGET` set to 10.7. The LLVM bitcode distributed in libstd's rlibs, then, is tagged with the target triple of `x86_64-apple-macosx10.7.0`, while the bitcode `rustc` produces for "user" code is tagged with the target triple of `x86_64-apple-darwin`. It's not good to have LTO on just Rust code (probably much more common than cross-language LTO) warn by default. These warnings also break Cargo's testsuite. This change defaults to acting as though `MACOSX_DEPLOYMENT_TARGET` was set to 10.7. "user" code will then be given a target triple that is equivalent to the target triple libstd bitcode is already using. The above warning will therefore go away. `rustc` already assumes that compiling without `MACOSX_DEPLOYMENT_TARGET` means that we're compiling for a target compatible with OS X 10.7 (e.g. that things like TLS work properly). So this change is really just making things conform more closely to the status quo. (It's also worth noting that before and after this patch, compiling with `MACOSX_DEPLOYMENT_TARGET` set to, say, 10.9, works just fine: target triples with an "apple" version ignore OS versions when checking compatibility, so bitcode with a `x86_64-apple-macosx10.7.0` triple works just fine with bitcode with a `x86_64-apple-macosx10.9.0` triple.)
2019-05-13Remove bitrig support from rustMarcel Hellwig-2/+0
2019-05-12Remove feature(nll) when compare mode is sufficientMatthew Jasper-1/+0
2019-05-07choose a more specific LLVM target on OS X when necessaryNathan Froyd-0/+52
This behavior matches clang's behavior, and makes cross-language LTO possible. Fixes #60235.
2019-05-07add negative tests for OS X LLVM target changesNathan Froyd-0/+52
2019-04-25Rollup merge of #60038 - michaelwoerister:pgo-updates-2, r=alexcrichtonMazdak Farrokhzad-0/+20
Add codegen test for PGO instrumentation. This PR adds a codegen test that makes sure that LLVM actually generates instrumentation code when we enable PGO instrumentation in `rustc`. The second commit updates a test case to the new commandline option syntax introduced in #59874. Without the fix the test still works, but it confusingly creates a directory called `test.profraw`, which usually is the name of the _file_ where profiling data is collected.
2019-04-23Remove unnecessary ignore-tidy-linelengthvarkor-13/+0
2019-04-22Remove double trailing newlinesvarkor-4/+0
2019-04-18Add codegen test that makes sure PGO instrumentation is emitted as expected.Michael Woerister-0/+20
2019-04-04Rollup merge of #59639 - cuviper:ignore-uninhabited, r=eddybMazdak Farrokhzad-0/+32
Never return uninhabited values at all Functions with uninhabited return values are already marked `noreturn`, but we were still generating return instructions for this. When running with `-C passes=lint`, LLVM prints: Unusual: Return statement in function with noreturn attribute The LLVM manual makes a stronger statement about `noreturn` though: > This produces undefined behavior at runtime if the function ever does dynamically return. We now emit an `abort` anywhere that would have tried to return an uninhabited value. Fixes #48227 cc #7463 #48229 r? @eddyb
2019-04-03Never return uninhabited values at allJosh Stone-0/+32
Functions with uninhabited return values are already marked `noreturn`, but we were still generating return instructions for this. When running with `-C passes=lint`, LLVM prints: Unusual: Return statement in function with noreturn attribute The LLVM manual makes a stronger statement about `noreturn` though: > This produces undefined behavior at runtime if the function ever does dynamically return. We now emit an `abort` anywhere that would have tried to return an uninhabited value.
2019-04-02Rollup merge of #59446 - Aaron1011:fix/debuginfo-overflow, r=oli-obkMazdak Farrokhzad-0/+15
Fix stack overflow when generating debuginfo for 'recursive' type By using 'impl trait', it's possible to create a self-referential type as follows: fn foo() -> impl Copy { foo } This is a function which returns itself. Normally, the signature of this function would be impossible to write - it would look like 'fn foo() -> fn() -> fn() ...' e.g. a function which returns a function, which returns a function... Using 'impl trait' allows us to avoid writing this infinitely long type. While it's useless for practical purposes, it does compile and run However, issues arise when we try to generate llvm debuginfo for such a type. All 'impl trait' types (e.g. ty::Opaque) are resolved when we generate debuginfo, which can lead to us recursing back to the original 'fn' type when we try to process its return type. To resolve this, I've modified debuginfo generation to account for these kinds of weird types. Unfortunately, there's no 'correct' debuginfo that we can generate - 'impl trait' does not exist in debuginfo, and this kind of recursive type is impossible to directly represent. To ensure that we emit *something*, this commit emits dummy debuginfo/type names whenever it encounters a self-reference. In practice, this should never happen - it's just to ensure that we can emit some kind of debuginfo, even if it's not particularly meaningful Fixes #58463
2019-03-31Add codegen testAaron Hill-0/+15
2019-03-31Auto merge of #59577 - dlrobertson:fix_58881, r=nagisabors-0/+21
Fix LLVM IR generated for C-variadic arguments It is possible to create malformed LLVM IR given variadic arguments that are aggregate types. This occurs due to improper tracking of the current argument in the functions list of arguments. Fixes: #58881
2019-03-31Fix LLVM IR generated for C-variadic argumentsDan Robertson-0/+21
It is possible to create malformed LLVM IR given variadic arguments that are aggregate types. This occurs due to improper tracking of the current argument in the functions list of arguments.
2019-03-31Fix testYuki OKUSHI-1/+1
2019-03-29Use platform dependent mcount functionYuki OKUSHI-0/+7
2019-03-26fix some uses I missedRalf Jung-1/+4
2019-03-22Correct minimum system LLVM version in testsSamuel Holland-4/+4
Since commit 9452a8dfa3ba, the new debug info format is only generated for LLVM 8 and newer versions. However, the tests still assume that LLVM 7 will use the new debug info format. Fix the tests (and a comment in the code) to match the actual version check.
2019-03-07Fix segfaults in release build C-variadic fnsDan Robertson-0/+19
`va_start` and `va_end` must be called to initialize/cleanup the "spoofed" `VaList` in a Rust defined C-variadic function even if the `VaList` is not used.
2019-02-27Support defining C compatible variadic functionsDan Robertson-0/+69
Add support for defining C compatible variadic functions in unsafe rust with extern "C".
2019-02-25Auto merge of #57609 - matthewjasper:more-restrictive-match, r=pnkfelixbors-2/+2
Use normal mutable borrows in matches `ref mut` borrows are currently two-phase with NLL enabled. This changes them to be proper mutable borrows. To accommodate this, first the position of fake borrows is changed: ```text [ 1. Pre-match ] | [ (old create fake borrows) ] [ 2. Discriminant testing -- check discriminants ] <-+ | | | (once a specific arm is chosen) | | | [ (old read fake borrows) ] | [ 3. Create "guard bindings" for arm ] | [ (create fake borrows) ] | | | [ 4. Execute guard code ] | [ (read fake borrows) ] --(guard is false)-----------+ | | (guard results in true) | [ 5. Create real bindings and execute arm ] | [ Exit match ] ``` The following additional changes are made to accommodate `ref mut` bindings: * We no longer create fake `Shared` borrows. These borrows are no longer needed for soundness, just to avoid some arguably strange cases. * `Shallow` borrows no longer conflict with existing borrows, avoiding conflicting access between the guard borrow access and the `ref mut` borrow. There is some further clean up done in this PR: * Avoid the "later used here" note for Shallow borrows (since it's not relevant with the message provided) * Make any use of a two-phase borrow activate it. * Simplify the cleanup_post_borrowck passes into a single pass. cc #56254 r? @nikomatsakis
2019-02-24Auto merge of #58315 - gnzlbg:returns_twice, r=alexcrichtonbors-0/+12
Implement unstable ffi_return_twice attribute This PR implements [RFC2633](https://github.com/rust-lang/rfcs/pull/2633) r? @eddyb
2019-02-24Auto merge of #58304 - gnzlbg:simd_saturated, r=nagisabors-0/+685
Add generic simd saturated add/sub intrinsics r? @eddyb
2019-02-23Fix attribute checkgnzlbg-2/+3
2019-02-23Use pattern to match attributesgnzlbg-9/+5
2019-02-23Implement ffi_returns_twice attributegnzlbg-0/+15
2019-02-21Fix codegen testMatthew Jasper-2/+2
2019-02-12Stabilize linker-plugin based LTO.Michael Woerister-2/+2
2019-02-10Auto merge of #58129 - RalfJung:maybe-uninit, r=cramertjbors-0/+3
MaybeUninit: some docs, rename into_inner -> into_initialized, return &mut from set
2019-02-08Move simd intrinsic codegen tests into the simd-intrinsic subdirgnzlbg-0/+0