about summary refs log tree commit diff
path: root/src/test/codegen
AgeCommit message (Collapse)AuthorLines
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
2019-02-08Add simd_saturating_{add,sub} intrinsicsgnzlbg-0/+685
2019-02-05extend box-maybe-uninit testRalf Jung-0/+3
2019-02-02Test alloca with #[repr(align(x))] on enumNiklas Fiekas-0/+36
2019-01-26Auto merge of #55641 - nagisa:optimize-attr, r=pnkfelixbors-0/+71
Implement optimize(size) and optimize(speed) attributes This PR implements both `optimize(size)` and `optimize(speed)` attributes. While the functionality itself works fine now, this PR is not yet complete: the code might be messy in places and, most importantly, the compiletest must be improved with functionality to run tests with custom optimization levels. Otherwise the new attribute cannot be tested properly. Oh, and not all of the RFC is implemented – attribute propagation is not implemented for example. # TODO * [x] Improve compiletest so that tests can be written; * [x] Assign a proper error number (E9999 currently, no idea how to allocate a number properly); * [ ] Perhaps reduce the duplication in LLVM attribute assignment code…
2019-01-25Rebase to the llvm-project monorepoJosh Stone-1/+4
The new git submodule src/llvm-project is a monorepo replacing src/llvm and src/tools/{clang,lld,lldb}. This also serves as a rebase for these projects to the new 8.x branch from trunk. The src/llvm-emscripten fork is unchanged for now.
2019-01-24Support revisions for codegen testsSimonas Kazlauskas-29/+51
`compile-flags: -Copt-level` will avoid adding -O. Similarly for -g and -Cdebuglevel.
2019-01-24Add an idealistic test for optimize attributeSimonas Kazlauskas-0/+49
Alas it does not currently work, because of limitations in compiletest…
2019-01-22Add intrinsic to create an integer bitmask from the MSB of integer vectorsgnzlbg-0/+57
2018-12-25Remove licensesMark Rousskov-1234/+0
2018-12-24Rollup merge of #57021 - nikic:arg-pointer-align, r=nagisaMazdak Farrokhzad-16/+16
Enable emission of alignment attrs for pointer params Instead disable creation of assumptions during inlining using an LLVM opt flag. For non-inlined functions, this gives us alignment information, while not inserting any assumes that kill other optimizations. The `-Z arg-align-attributes` option which previously controlled this behavior is removed. Fixes #54982. r? @nagisa cc @eddyb who added the current behavior, and @scottmcm, who added the `-Z arg-align-attributes` flag.
2018-12-23Rollup merge of #57078 - glaubitz:ignore-tests, r=nikicMazdak Farrokhzad-0/+1
Ignore two tests on s390x Ignore two tests on s390x which don't make sense on s390x as they are x86-specific.
2018-12-23Rollup merge of #57053 - nikic:fix-gep-align, r=nagisaMazdak Farrokhzad-0/+80
Fix alignment for array indexing We need to reduce the alignment with the used offset. If the offset isn't known, use the element size, as this will yield the minimum possible alignment. This handles both direct array indexing, and array repeat expressions. Fixes #56927. r? @nagisa
2018-12-23test: Ignore codegen/x86_mmx.rs on s390xJohn Paul Adrian Glaubitz-0/+1
2018-12-21Fix alignment for array indexingNikita Popov-0/+80
We need to reduce the alignment with the used offset. If the offset isn't known, we need to reduce with the element size to support arbitrary offsets.
2018-12-21Stabilize #[repr(packed(N))]Taylor Cramer-1/+0
2018-12-21Enable emission of alignment attrs for pointer paramsNikita Popov-16/+16
Instead disable creation of assumptions during inlining using an LLVM opt flag. The -Z arg-align-attributes option which previously controlled this behavior is removed.
2018-12-17Auto merge of #56642 - nikic:llvm-6, r=alexcrichtonbors-7/+0
Bump minimum required LLVM version to 6.0 Based on the discussion in #55842, while the overall position of Rust wrt LLVM continues to be contentious, there does seem to be a consensus that there is no need for continued support of LLVM 5. This PR bumps our version requirement to LLVM 6.0 and makes Travis run against that. I hope that this is going to unblock #52694. If I understand correctly, while this issue still exists in LLVM 6, Ubuntu has backported the relevant patch. r? @alexcrichton
2018-12-13rustc: Add an unstable `simd_select_bitmask` intrinsicAlex Crichton-0/+12
This is going to be required for binding a number of AVX-512 intrinsics in the `stdsimd` repository, and this intrinsic is the same as `simd_select` except that it takes a bitmask as the first argument instead of a SIMD vector. This bitmask is then transmuted into a `<NN x i8>` argument, depending on how many bits it is. cc rust-lang-nursery/stdsimd#310
2018-12-12rustc: Switch `extern` functions to abort by default on panicAlex Crichton-0/+16
This was intended to land way back in 1.24, but it was backed out due to breakage which has long since been fixed. An unstable `#[unwind]` attribute can be used to tweak the behavior here, but this is currently simply switching rustc's internal default to abort-by-default if an `extern` function panics, making our codegen sound primarily (as currently you can produce UB with safe code) Closes #52652
2018-12-09Bump minimum required LLVM version to 6.0Nikita Popov-7/+0
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-2/+2
2018-12-03Auto merge of #55010 - tromey:Bug-9224-generic-parameters, r=michaelwoeristerbors-0/+28
Add template parameter debuginfo to generic types This changes debuginfo generation to add template parameters to generic types. With this change the DWARF now has DW_TAG_template_type_param for types, not just for functions, like: <2><40d>: Abbrev Number: 6 (DW_TAG_structure_type) <40e> DW_AT_name : (indirect string, offset: 0x375): Generic<i32> <412> DW_AT_byte_size : 4 <413> DW_AT_alignment : 4 ... <3><41f>: Abbrev Number: 8 (DW_TAG_template_type_param) <420> DW_AT_type : <0x42a> <424> DW_AT_name : (indirect string, offset: 0xa65e): T Closes #9224
2018-11-30Enable -mergefunc-use-aliasesNikita Popov-5/+8
If the Rust LLVM fork is used, enable the -mergefunc-use-aliases flag, which will create aliases for merged functions, rather than inserting a call from one to the other. A number of codegen tests needed to be adjusted, because functions that previously fell below the thunk limit are now being merged. Merging is prevented either using -C no-prepopulate-passes, or by making the functions non-identical. I expect that this is going to break something, somewhere, because it isn't able to deal with aliases properly, but we won't find out until we try :) This fixes #52651.
2018-11-29Add template parameter debuginfo to generic typesTom Tromey-0/+28
This changes debuginfo generation to add template parameters to generic types. With this change the DWARF now has DW_TAG_template_type_param for types, not just for functions, like: <2><40d>: Abbrev Number: 6 (DW_TAG_structure_type) <40e> DW_AT_name : (indirect string, offset: 0x375): Generic<i32> <412> DW_AT_byte_size : 4 <413> DW_AT_alignment : 4 ... <3><41f>: Abbrev Number: 8 (DW_TAG_template_type_param) <420> DW_AT_type : <0x42a> <424> DW_AT_name : (indirect string, offset: 0xa65e): T Closes #9224