about summary refs log tree commit diff
path: root/src/test/codegen
AgeCommit message (Collapse)AuthorLines
2017-11-07Saturating casts between integers and floats (both directions).Robin Kruppe-0/+65
This affects regular code generation as well as constant evaluation in trans, but not the HIR constant evaluator because that one returns an error for overflowing casts and NaN-to-int casts. That error is conservatively correct and we should be careful to not accept more code in constant expressions. The changes to code generation are guarded by a new -Z flag, to be able to evaluate the performance impact. The trans constant evaluation changes are unconditional because they have no run time impact and don't affect type checking either.
2017-11-07Update codegen tests.Michael Woerister-20/+20
2017-10-26Avoid unnecessary copies of arguments that are simple bindingsBjörn Steinbrink-38/+36
Initially MIR differentiated between arguments and locals, which introduced a need to add extra copies assigning the argument to a local, even for simple bindings. This differentiation no longer exists, but we're still creating those copies, bloating the MIR and LLVM IR we emit. Additionally, the current approach means that we create debug info for both the incoming argument (marking it as an argument), and then immediately shadow it a local that goes by the same name. This can be confusing when using e.g. "info args" in gdb, or when e.g. a debugger with a GUI displays the function arguments separately from the local variables, especially when the binding is mutable, because the argument doesn't change, while the local variable does.
2017-10-21Auto merge of #45391 - malbarbo:x32-1, r=alexcrichtonbors-0/+1
Update libc and some fixes for x86_64-unknown-linux-gnux32
2017-10-20Fix some tests for linux gnux32Marco A L Barbosa-0/+1
2017-10-18Remove two obsolete min-llvm-version testsJosh Stone-1/+0
2017-10-16Update the codegen/mainsubprogram tests to min-llvm 4.0Josh Stone-8/+6
The necessary changes were only in upstream LLVM in 4.0, but they were for a while backported to Rust LLVM. Now that Rust LLVM is also 4.0, we can make the test conditional here more accurate.
2017-10-11rustc: Add LLVM `nounwind` with `-C panic=abort`Alex Crichton-1/+40
This informs LLVM that functions can't unwind, which while it should typically have already been inferred when necessary or otherwise not impact codegen is apparently needed on targets like ARM to avoid references to unnecessary symbols. Closes #44992
2017-10-07Fix typo in codegen testRobin Kruppe-1/+1
2017-10-05Auto merge of #44940 - philipc:remap-path, r=michaelwoeristerbors-0/+23
Don't use remapped path when loading modules and include files Fixes bug reported in https://github.com/rust-lang/rust/issues/41555#issuecomment-327866056. cc @michaelwoerister
2017-09-30rustc: Use 16bit c_int for msp430Daniel Klauer-0/+35
Fix regression from c2fe69b9, where main() signature was changed from using 16bit isize to 32bit c_int for argc parameter/result.
2017-09-30Don't use remapped path when loading modules and include filesPhilip Craig-0/+23
2017-09-28test: Check native main() signatureDaniel Klauer-0/+17
2017-09-02add test for not optimized `pow` with constant powerEvgeniy A. Dushistov-0/+23
Closes #34947
2017-08-28std: Mark allocation functions as nounwindAlex Crichton-0/+32
This commit flags all allocation-related functions in liballoc as "this can't unwind" which should largely resolve the size-related issues found on #42808. The documentation on the trait was updated with such a restriction (they can't panic) as well as some other words about the relative instability about implementing a bullet-proof allocator. Closes #42808
2017-08-06Auto merge of #43488 - Florob:repeat-opt, r=arielb1bors-0/+74
Optimize initialization of arrays using repeat expressions This PR was inspired by [this thread](https://www.reddit.com/r/rust/comments/6o8ok9/understanding_rust_performances_a_newbie_question/) on Reddit. It tries to bring array initialization in the same ballpark as `Vec::from_elem()` for unoptimized builds. For optimized builds this should relieve LLVM of having to figure out the construct we generate is in fact a `memset()`. To that end this emits `llvm.memset()` when: * the array is of integer type and all elements are zero (`Vec::from_elem()` also explicitly optimizes for this case) * the array elements are byte sized If the array is zero-sized initialization is omitted entirely.
2017-08-05codegen tests: Check type of `len` argument to `llvm.memset.*` based on the ↵Florian Zeitz-3/+3
exact intrinsic used
2017-07-29std: Mark `Layout::repeat` as `#[inline]`Alex Crichton-0/+21
This fixes an optimization regression by allowing LLVM to see through more functions. Closes #43272
2017-07-26trans: Optimize initialization using repeat expressionsFlorian Zeitz-0/+74
This elides initialization for zero-sized arrays: * for zero-sized elements we previously emitted an empty loop * for arrays with a length of zero we previously emitted a loop with zero iterations This emits llvm.memset() instead of a loop over each element when: * all elements are zero integers * elements are byte sized
2017-07-24Add a disabled builder for aarch64 emulated testsAlex Crichton-0/+1
This commit adds a disabled builder which will run all tests for the standard library for aarch64 in a QEMU instance. Once we get enough capacity to run this on Travis this can be used to boost our platform coverage of AArch64
2017-07-23Auto merge of #43387 - TimNN:rustllvm50, r=alexcrichtonbors-8/+8
Update Rust LLVM bindings for LLVM 5.0 This is the initial set of changes to update the rust llvm bindings for 5.0. The llvm commits necessitating these changes are linked from the tracking issue, #43370.
2017-07-21Relax a codegen test to be compatible with LLVM 5.0Alex Crichton-8/+8
2017-07-21Ignore stack probe tests on AArch64Mátyás Mustoha-0/+1
2017-07-18powerpc: Ignore the stack-probes testLuca Barbato-0/+1
2017-07-12[LLVM] Avoid losing the !nonnull attribute in SROAAriel Ben-Yehuda-0/+36
This still does not work on 32-bit archs because of an LLVM limitation, but this is only an optimization, so let's push it on 64-bit only for now. Fixes #37945
2017-07-06rustc: Implement stack probes for x86Alex Crichton-0/+24
This commit implements stack probes on x86/x86_64 using the freshly landed support upstream in LLVM. The purpose of stack probes here are to guarantee a segfault on stack overflow rather than having a chance of running over the guard page already present on all threads by accident. At this time there's no support for any other architecture because LLVM itself does not have support for other architectures.
2017-07-05rustc: Implement the #[global_allocator] attributeAlex Crichton-1/+1
This PR is an implementation of [RFC 1974] which specifies a new method of defining a global allocator for a program. This obsoletes the old `#![allocator]` attribute and also removes support for it. [RFC 1974]: https://github.com/rust-lang/rfcs/pull/197 The new `#[global_allocator]` attribute solves many issues encountered with the `#![allocator]` attribute such as composition and restrictions on the crate graph itself. The compiler now has much more control over the ABI of the allocator and how it's implemented, allowing much more freedom in terms of how this feature is implemented. cc #27389
2017-06-19Auto merge of #39409 - pnkfelix:mir-borrowck2, r=nikomatsakisbors-1/+1
MIR EndRegion Statements (was MIR dataflow for Borrows) This PR adds an `EndRegion` statement to MIR (where the `EndRegion` statement is what terminates a borrow). An earlier version of the PR implemented a dataflow analysis on borrow expressions, but I am now factoring that into a follow-up PR so that reviewing this one is easier. (And also because there are some revisions I want to make to that dataflow code, but I want this PR to get out of WIP status...) This is a baby step towards MIR borrowck. I just want to get the review process going while I independently work on the remaining steps.
2017-06-15Add a no-system-llvm compilecheck headerSimonas Kazlauskas-9/+3
2017-06-12Update test/codegen/drop.rs to reflect inconsequential change in basic block ↵Felix S. Klock II-1/+1
ordering.
2017-06-08Upgrade LLVMSimonas Kazlauskas-0/+28
Includes https://github.com/rust-lang/llvm/pull/80 Includes https://github.com/rust-lang/llvm/pull/79 Also adds tests and thus fixes #24194
2017-06-06rustc_trans: do not store pair fields if they are ZSTs.Eduard-Mihai Burtescu-4/+6
2017-06-02compiletest: Force directive to be first complete word in header comment.kennytm-1/+1
Refactored some related code to take advantage of this change.
2017-06-01Adding support for the llvm `prefetch` intrinsicFalco Hirschenberger-0/+75
Related to #37251
2017-05-01Add simple `[repr(align)]` codegen test.Cameron Hart-0/+57
Checks alloca and memcpy are aligned correctly.
2017-04-28Disable path remapping test on Windows.Michael Woerister-0/+1
2017-04-26Make codegen test for remap-path-prefix more thorough.Michael Woerister-5/+34
2017-04-26Implement a file-path remapping feature in support of debuginfo and ↵Michael Woerister-0/+19
reproducible builds.
2017-04-22remove cleanup branches to the resume blockAriel Ben-Yehuda-1/+2
This improves LLVM performance by 10% lost during the shimmir transition.
2017-04-18lower `move_val_init` during MIR constructionAriel Ben-Yehuda-0/+29
Because of its "magic" order-of-evaluation semantics, `move_val_init` must be lowered during MIR construction in order to work.
2017-04-14Rollup merge of #40702 - mrhota:global_asm, r=nagisaCorey Farwell-0/+234
Implement global_asm!() (RFC 1548) This is a first attempt. ~~One (potential) problem I haven't solved is how to handle multiple usages of `global_asm!` in a module/crate. It looks like `LLVMSetModuleInlineAsm` overwrites module asm, and `LLVMAppendModuleInlineAsm` is not provided in LLVM C headers 😦~~ I can provide more detail as needed, but honestly, there's not a lot going on here. r? @eddyb CC @Amanieu @jackpot51 Tracking issue: #35119
2017-04-12Add global_asm testsA.J. Gardner-0/+234
2017-04-12rustc_trans: avoid a separate entry BB if START_BLOCK has no backedges.Eduard-Mihai Burtescu-10/+37
2017-04-09rustc_trans: use ty::layout for ABI computation instead of LLVM types.Eduard-Mihai Burtescu-2/+2
2017-03-31Ignore tests for the personality slot lifetimes on MSVCBjörn Steinbrink-0/+2
Exception handling on MSVC targets doesn't use personality slots.
2017-03-29Emit proper lifetime start intrinsics for personality slotsBjörn Steinbrink-0/+39
We currently only emit a single call to the lifetime start intrinsic for the personality slot alloca. This happens because we create that call at the time that we create the alloca, instead of creating it each time we start using it. Because LLVM usually removes the alloca before the lifetime intrinsics are even considered, this didn't cause any problems yet, but we should fix this anyway.
2017-03-21rustc: Always emit the `uwtable` attribute on WindowsAlex Crichton-0/+41
This commit alters the translation layer to unconditionally emit the `uwtable` LLVM attribute on Windows regardless of the `no_landing_pads` setting. Previously I believe we omitted this attribute as an optimization when the `-Cpanic=abort` flag was passed, but this unfortunately caused problems for Gecko. It [was discovered] that there was trouble unwinding through Rust functions due to foreign exceptions such as illegal instructions or otherwise in-practice methods used to abort a process. In testing it looked like the major difference between a working binary and a non-working binary is indeed this `uwtable` attribute, but this PR has unfortunately not been thoroughly tested in terms of compiling Gecko with `-C panic=abort` *and* this PR to see whether it works, so this is still somewhat working on just suspicion. [was discovered]: https://bugzilla.mozilla.org/show_bug.cgi?id=1302078
2017-03-13emit !align attributes on stores of operand pairsAriel Ben-Yehuda-0/+33
cc #40373
2017-03-07Add tests for issues with the 'E-needtest' label.topecongiro-0/+39
2017-03-03Auto merge of #40133 - arielb1:operand-lifetimes, r=eddybbors-5/+3
[MIR] improve operand lifetimes r? @eddyb