about summary refs log tree commit diff
path: root/src/test/codegen
AgeCommit message (Collapse)AuthorLines
2020-01-07Update codegen tests with unnamed argumentsNikita Popov-8/+8
2020-01-07Update bool-cmp.rs codegenNikita Popov-2/+3
2019-12-30Use function attribute "frame-pointer" instead of "no-frame-pointer-elim"Fangrui Song-3/+4
LLVM 8 (D56351) introduced "frame-pointer". In LLVM 10 (D71863), "no-frame-pointer-elim"/"no-frame-pointer-elim-non-leaf" will be ignored.
2019-12-14Revert "Remove `#![feature(never_type)]` from tests."Niko Matsakis-0/+2
This reverts commit 8f6197f39f7d468dfc5b2bd41dae4769992a2f83.
2019-12-11Rollup merge of #66881 - ↵Mazdak Farrokhzad-0/+17
krishna-veerareddy:issue-66780-bool-ord-optimization, r=sfackler Optimize Ord trait implementation for bool Casting the booleans to `i8`s and converting their difference into `Ordering` generates better assembly than casting them to `u8`s and comparing them. Fixes #66780 #### Comparison([Godbolt link](https://rust.godbolt.org/z/PjBpvF)) ##### Old assembly: ```asm example::boolean_cmp: mov ecx, edi xor ecx, esi test esi, esi mov eax, 255 cmove eax, ecx test edi, edi cmovne eax, ecx ret ``` ##### New assembly: ```asm example::boolean_cmp: mov eax, edi sub al, sil ret ``` ##### Old LLVM-MCA statistics: ``` Iterations: 100 Instructions: 800 Total Cycles: 234 Total uOps: 1000 Dispatch Width: 6 uOps Per Cycle: 4.27 IPC: 3.42 Block RThroughput: 1.7 ``` ##### New LLVM-MCA statistics: ``` Iterations: 100 Instructions: 300 Total Cycles: 110 Total uOps: 500 Dispatch Width: 6 uOps Per Cycle: 4.55 IPC: 2.73 Block RThroughput: 1.0 ```
2019-12-07Rollup merge of #67054 - RalfJung:set-discriminant-unreachable, r=oli-obkYuki Okushi-0/+43
codegen "unreachable" for invalid SetDiscriminant Follow-up from https://github.com/rust-lang/rust/pull/66960. I also realized I don't understand our policy for using `abort` vs `unreachable`. AFAIK `abort` is safe to call and just aborts the process, while `unreachable` is UB. But sometimes we use both, like here https://github.com/rust-lang/rust/blob/d825e35ee8325146e6c175a4c61bcb645b347d5e/src/librustc_codegen_ssa/mir/block.rs#L827-L828 and here https://github.com/rust-lang/rust/blob/d825e35ee8325146e6c175a4c61bcb645b347d5e/src/librustc_codegen_ssa/mir/block.rs#L264-L265 The second case is even more confusing because that looks like an unreachable `return` to me, so why would we codegen a safe abort there? r? @eddyb Cc @oli-obk
2019-12-06use abort instead of unreachableRalf Jung-3/+3
2019-12-05add a testRalf Jung-0/+43
2019-12-05Auto merge of #66520 - alexcrichton:disable-gdb-wasm, r=eddybbors-0/+2
Disable gdb pretty printer global section on wasm targets The wasm targets don't support gdb anyway so there's no need for this section there.
2019-12-04Disable gdb pretty printer global section on wasm targetsAlex Crichton-0/+2
The wasm targets don't support gdb anyway so there's no need for this section there.
2019-12-02Update the minimum external LLVM to 7Josh Stone-8/+0
LLVM 7 is over a year old, which should be plenty for compatibility. The last LLVM 6 holdout was llvm-emscripten, which went away in #65501. I've also included a fix for LLVM 8 lacking `MemorySanitizerOptions`, which was broken by #66522.
2019-11-29Optimize Ord trait implementation for boolKrishna Sai Veera Reddy-0/+17
Casting the booleans to `i8`s and converting their difference into `Ordering` generates better assembly than casting them to `u8`s and comparing them.
2019-11-29Auto merge of #66645 - RalfJung:dereferenceable, r=pnkfelixbors-1/+3
remove the 'dereferenceable' attribute from Box Fixes https://github.com/rust-lang/rust/issues/66600 r? @eddyb @rkruppe
2019-11-22remove the 'dereferenceable' attribute from BoxRalf Jung-1/+3
2019-11-22Add support for tracking origins of uninitialized memoryTomasz Miąsko-0/+28
2019-11-22Add support for sanitizer recoveryTomasz Miąsko-0/+34
2019-11-21Introduce MIR optimizations for simplifying `x?` on `Result`s.Mazdak Farrokhzad-3/+22
This optimization depends on inlining for the identity conversions introduced by the lowering of the `?`. To take advantage of `SimplifyArmIdentity`, `-Z mir-opt-level=2` is required because that triggers the inlining MIR optimization.
2019-11-21Remove `#![feature(never_type)]` from tests.Mazdak Farrokhzad-2/+0
Also remove `never_type` the feature-gate test.
2019-11-11[mir-opt] Turn on the `ConstProp` pass by defaultWesley Wiser-3/+3
perf.rlo shows that running the `ConstProp` pass results in across-the-board wins regardless of debug or opt complilation mode. As a result, we're turning it on to get the compile time benefits. `ConstProp` doesn't currently intern the memory used by its `Machine` so we can't yet propagate allocations which is why `ConstProp::should_const_prop()` checks if the value being propagated is a scalar or not.
2019-11-04Do not require extra LLVM backends for `x.py test` to passVadim Petrochenkov-5/+1
2019-10-31rustc_codegen_ssa: move all set_var_name calls to mir::debuginfo.Eduard-Mihai Burtescu-86/+99
2019-10-29Rollup merge of #65832 - tlively:emscripten-exception-handling, r=alexcrichtonTyler Mandry-5/+5
Re-enable Emscripten's exception handling support Passes LLVM codegen and Emscripten link-time flags for exception handling if and only if the panic strategy is `unwind`. Sets the default panic strategy for Emscripten targets to `unwind`. Re-enables tests that depend on unwinding support for Emscripten, including `should_panic` tests. r? @alexcrichton
2019-10-26Only run efiapi test on llvm 9.0+roblabla-0/+2
2019-10-25Re-enable Emscripten's exception handling supportThomas Lively-5/+5
Passes LLVM codegen and Emscripten link-time flags for exception handling if and only if the panic strategy is `unwind`. Sets the default panic strategy for Emscripten targets to `unwind`. Re-enables tests that depend on unwinding support for Emscripten, including `should_panic` tests.
2019-10-25Fix EFIABI testroblabla-12/+21
Use revisions to run the EFIABI in multiple configurations, compiling for each supported UEFI platform, and checking the ABI generated in the LLVM IR is correct. Use no_core to make it easier to test.
2019-10-25Add new EFIAPI ABIroblabla-0/+20
Adds a new ABI for the EFIAPI calls. This ABI should reflect the latest version of the UEFI specification at the time of commit (UEFI spec 2.8, URL below). The specification says that for x86_64, we should follow the win64 ABI, while on all other supported platforms (ia32, itanium, arm, arm64 and risc-v), we should follow the C ABI. To simplify the implementation, we will simply follow the C ABI on all platforms except x86_64, even those technically unsupported by the UEFI specification. https://uefi.org/sites/default/files/resources/UEFI_Spec_2_8_final.pdf
2019-10-16Upgrade Emscripten targets to use upstream LLVM backendThomas Lively-118/+92
- Compatible with Emscripten 1.38.46-upstream or later upstream. - Refactors the Emscripten target spec to share code with other wasm targets. - Replaces the old incorrect wasm32 C call ABI with the correct one, preserving the old one as wasm32_bindgen_compat for wasm-bindgen compatibility. - Updates the varargs ABI used by Emscripten and deletes the old one. - Removes the obsolete wasm32-experimental-emscripten target. - Uses EMCC_CFLAGS on CI to avoid the timeout problems with #63649.
2019-10-12make tests more robustRalf Jung-2/+2
2019-10-12some typographyRalf Jung-2/+2
2019-10-12also (properly) test nounwind on function definitionsRalf Jung-6/+19
2019-10-12update test for nounwind on FFI importsRalf Jung-19/+41
2019-09-28Gate llvm.sideeffect under -Z insert-sideeffectXiang Fan-35/+19
2019-09-28Add llvm.sideeffect to potential infinite loops and recursionsXiang Fan-16/+82
LLVM assumes that a thread will eventually cause side effect. This is not true in Rust if a loop or recursion does nothing in its body, causing undefined behavior even in common cases like `loop {}`. Inserting llvm.sideeffect fixes the undefined behavior. As a micro-optimization, only insert llvm.sideeffect when jumping back in blocks or calling a function. A patch for LLVM is expected to allow empty non-terminate code by default and fix this issue from LLVM side. https://github.com/rust-lang/rust/issues/28728
2019-09-13codegen: use "_N" (like for other locals) instead of "argN", for argument names.Eduard-Mihai Burtescu-54/+54
2019-09-12codegen: be more explicit about setting giving names to allocas.Eduard-Mihai Burtescu-4/+5
2019-09-09test/c-variadic: Fix patterns on powerpc64Samuel Holland-11/+12
On architectures such as powerpc64 that use extend_integer_width_to in their C ABI processing, integer parameters shorter than the native register width will be annotated with the ArgAttribute::SExt or ArgAttribute::ZExt attribute, and that attribute will be included in the generated LLVM IR. In this test, all relevant parameters are `i32`, which will get the `signext` annotation on the relevant 64-bit architectures. Match both the annotated and non-annotated case, but enforce that the annotation is applied consistently.
2019-09-06rustc_codegen_llvm: give names to non-alloca variable values.Eduard-Mihai Burtescu-0/+15
2019-08-29Small improvement for Ord implementation of integersLzu Tao-2/+2
2019-08-26add link to FileCheck docsRalf Jung-0/+2
2019-08-25Force #[unwind(aborts)] in test/codegen/c-variadic.rsJosh Stone-0/+6
2019-08-21Add codegen test for integers compareLzu Tao-0/+28
2019-08-19Cherry-pick src/test changes with Centril's changessd234678-3/+0
2019-08-12Add codegen tests for the genericity of fold closuresJosh Stone-0/+24
2019-07-16Auto merge of #62592 - nikic:actually-update-llvm, r=alexcrichtonbors-12/+14
Update to LLVM 9 trunk Following the preparatory changes in #62474, this updates the LLVM submodule to https://github.com/rust-lang/llvm-project/tree/rustc/9.0-2019-07-12 and: * Changes the LLVM Rust bindings to account for the new SubtargetSubTypeKV. * Adjusts a codegen test for the new form of the byval attribute that takes a type. * Makes a PGO codegen test more liberal with regard to order and linkage. * Builds InstrProfilingPlatformWindows.c as part of libprofiler_builtins. * Moves registration of additional passes (in particular sanitizers) to the end of the module pass manager. * Disables LLDB on builders. r? @alexcrichton
2019-07-15ignore some codegen tests in debug modeRalf Jung-0/+3
2019-07-15Relax checks in pgo-instrumentation codegen testNikita Popov-4/+4
Don't require a specific order for the per-function globals, and don't require the locals to have private linkage (apparently internal linkage is also possible).
2019-07-15Update transparent aggregate codegen test for byval changesNikita Popov-8/+10
2019-07-09Adjust codegen tests for DISPFlagMainSubprogramNikita Popov-2/+2
2019-06-21Stabilize profile-guided optimization.Michael Woerister-2/+2
2019-06-18Auto merge of #59625 - immunant:copy_variadics_typealias, r=eddybbors-3/+30
Refactor C FFI variadics to more closely match their C counterparts, and add Clone implementation We had to make some changes to expose `va_copy` and `va_end` directly to users (mainly for C2Rust, but not exclusively): - redefine the Rust variadic structures to more closely correspond to C: `VaList` now matches `va_list`, and `VaListImpl` matches `__va_list_tag` - add `Clone` for `VaListImpl` - add explicit `as_va_list()` conversion function from `VaListImpl` to `VaList` - add deref coercion from `VaList` to `VaListImpl` - add support for the `asmjs` target All these changes were needed for use cases like: ```Rust let mut ap2 = va_copy(ap); vprintf(fmt, ap2); va_end(&mut ap2); ```