about summary refs log tree commit diff
path: root/src/test/codegen
AgeCommit message (Collapse)AuthorLines
2020-06-15Update sanitizer testNathan Corbyn-1/+2
2020-06-15Fix sanitizer testNathan Corbyn-2/+1
2020-06-15Fix whitespaceNathan Corbyn-1/+1
2020-06-15Fix exports with `#[inline(always)]`Nathan Corbyn-8/+63
2020-06-15Fix whitespaceNathan Corbyn-1/+1
2020-06-15Export all fns with extern indicatorNathan Corbyn-26/+61
2020-06-15Export `#[inline] #[no_mangle]` fns in cdylibs and staticlibsNathan Corbyn-0/+26
2020-06-15Test that bounds checks are elided when slice len is checked up-frontErik Desjardins-0/+26
2020-06-13compiletest: Add directives to detect sanitizer supportTomasz Miąsko-11/+6
Add needs-sanitizer-{address,leak,memory,thread} directive indicating that test requires target with support for specific sanitizer. This is an addition to the existing needs-sanitizer-support directive indicating that test requires a sanitizer runtime library.
2020-06-07Rollup merge of #72977 - tblah:riscv-codegen-llvm10, r=nikomatsakisDylan DPC-41/+93
Fix codegen tests for RISC-V Some codegen tests didn't seem relevant (e.g. unsupported annotations). The RISC-V abi tests were broken by LLVM 10, c872dcf fixes that (cc: @msizanoen1) I'm not sure about skipping catch-unwind.rs and included that change here mostly as a request for comment - I can't tell if that's a bug.
2020-06-04Revert "Defer creating drop trees in MIR lowering until leaving that scope"Felix S. Klock II-3/+3
This reverts commit 611988551fba1bcbb33ae2e1e0171cb8d2e70d5a.
2020-06-04test: codegen: skip catch-unwind on riscv64Tom Eccles-0/+9
It isn't clear to me if this is a bug or not, hence the FIXME
2020-06-04test: codegen: Add riscv abi llvm intrinsics testTom Eccles-0/+32
2020-06-04test: codegen: riscv64-abi: print value numbers for unnamed func argsTom Eccles-41/+41
LLVM 10 includes a009a60a917bc30940422bcef73f8270566d78db which will print value numbers for unnamed func args. Update these tests to be in line with the referenced clang tests.
2020-06-04test: codegen: skip tests inappropriate for riscv64Tom Eccles-0/+11
2020-05-27Omit DW_AT_linkage_name when it is the same as DW_AT_nameTomasz Miąsko-0/+42
The DWARF standard suggests that it might be useful to include `DW_AT_linkage_name` when it is *distinct* from the identifier name.
2020-05-24Added a codegen test for a recent optimization for overflow-checks=onAlex Gaynor-0/+26
Closes #58692
2020-05-21Auto merge of #71718 - NeoRaider:ffi_const_pure, r=Amanieubors-0/+24
Experimentally add `ffi_const` and `ffi_pure` extern fn attributes Add FFI function attributes corresponding to clang/gcc/... `const` and `pure`. Rebased version of #58327 by @gnzlbg with the following changes: - Switched back from the `c_ffi_const` and `c_ffi_pure` naming to `ffi_const` and `ffi_pure`, as I agree with https://github.com/rust-lang/rust/pull/58327#issuecomment-462718772 and this nicely aligns with `ffi_returns_twice` - (Hopefully) took care of all of @hanna-kruppe's change requests in the original PR r? @hanna-kruppe
2020-05-21Auto merge of #72205 - ecstatic-morse:nrvo, r=oli-obkbors-2/+19
Dumb NRVO This is a very simple version of an NRVO pass, which scans backwards from the `return` terminator to see if there is an an assignment like `_0 = _1`. If a basic block with two or more predecessors is encountered during this scan without first seeing an assignment to the return place, we bail out. This avoids running a full "reaching definitions" dataflow analysis. I wanted to see how much `rustc` would benefit from even a very limited version of this optimization. We should be able to use this as a point of comparison for more advanced versions that are based on live ranges. r? @ghost
2020-05-20Rollup merge of #72139 - nnethercote:standalone-fold, r=cuviperDylan DPC-24/+0
Make `fold` standalone. `fold` is currently implemented via `try_fold`, but implementing it directly results in slightly less LLVM IR being generated, speeding up compilation of some benchmarks. r? @cuviper
2020-05-20Add tests for `#[ffi_const]` and `#[ffi_pure]` function attributesMatthias Schiffer-0/+24
Based on the work of gnzlbg <gonzalobg88@gmail.com>.
2020-05-18Add tests for asm!Amanieu d'Antras-0/+96
2020-05-18Make `fold` standalone.Nicholas Nethercote-24/+0
`fold` is currently implemented via `try_fold`, but implementing it directly results in slightly less LLVM IR being generated, speeding up compilation of some benchmarks. (And likewise for `rfold`.) The commit adds `fold` implementations to all the iterators that lack one but do have a `try_fold` implementation. Most of these just call the `try_fold` implementation directly.
2020-05-17Test that NRVO elides the call to `memcpy`Dylan MacKenzie-0/+17
2020-05-16Disable MIR optimization for alignment codegen testsDylan MacKenzie-2/+2
NRVO optimizes away the locals whose alignment is tested. I don't think this affects the purpose of the test.
2020-05-11cmdline: Make target features individually overridableVadim Petrochenkov-0/+9
2020-05-09Defer creating drop trees in MIR lowering until leaving that scopeMatthew Jasper-3/+3
2020-05-07Rollup merge of #71952 - JohnTitor:add-tests, r=Dylan-DPCDylan DPC-0/+25
Add some regression tests Closes #29988 Closes #34979 Pick up two snippets that have been fixed from #67945 (shouldn't be closed yet!)
2020-05-08Add some skip flagsYuki Okushi-1/+4
2020-05-07Add test for #29988Yuki Okushi-0/+22
2020-05-06Rollup merge of #71269 - Mark-Simulacrum:sat-float-casts, r=nikicDylan DPC-6/+6
Define UB in float-to-int casts to saturate This closes #10184 by defining the behavior there to saturate infinities and values exceeding the integral range (on the lower or upper end). `NaN` is sent to zero.
2020-05-06Define UB in float-to-int casts to saturateMark Rousskov-6/+6
- Round to zero, and representable values cast directly. - `NaN` goes to 0 - Values beyond the limits of the type are saturated to the "nearest value" (essentially rounding to zero, in some sense) in the integral type, so e.g. `f32::INFINITY` would go to `{u,i}N::MAX.`
2020-05-04Add Option to Force Unwind TablesSam Elliott-0/+7
When panic != unwind, `nounwind` is added to all functions for a target. This can cause issues when a panic happens with RUST_BACKTRACE=1, as there needs to be a way to reconstruct the backtrace. There are three possible sources of this information: forcing frame pointers (for which an option exists already), debug info (for which an option exists), or unwind tables. Especially for embedded devices, forcing frame pointers can have code size overheads (RISC-V sees ~10% overheads, ARM sees ~2-3% overheads). In code, it can be the case that debug info is not kept, so it is useful to provide this third option, unwind tables, that users can use to reconstruct the call stack. Reconstructing this stack is harder than with frame pointers, but it is still possible. This commit adds a compiler option which allows a user to force the addition of unwind tables. Unwind tables cannot be disabled on targets that require them for correctness, or when using `-C panic=unwind`.
2020-04-20Fix codegen and mir-opt testsJonas Schievink-2/+2
Mostly renamed allocations, but I'm not sure about the const prop tests
2020-04-18Auto merge of #71147 - cuviper:min-llvm8, r=Mark-Simulacrumbors-26/+13
Update the minimum external LLVM to 8 LLVM 8 was released on March 20, 2019, over a year ago.
2020-04-15Use `call` instead of `invoke` for functions that cannot unwindWesley Wiser-8/+35
The `FnAbi` now knows if the function is allowed to unwind. If a function isn't allowed to unwind, we can use a `call` instead of an `invoke`. This resolves an issue when calling LLVM intrinsics which cannot unwind LLVM will generate an error if you attempt to invoke them so we need to ignore cleanup blocks in codegen and generate a call instead.
2020-04-14Update the minimum external LLVM to 8Josh Stone-26/+13
LLVM 8 was released on March 20, 2019, over a year ago.
2020-04-02Add hash of source files in debug infoArlo Siemsen-3/+15
* Adds either an MD5 or SHA1 hash to the debug info. * Adds new unstable option `-Z src-hash-algorithm` to control the hashing algorithm.
2020-03-26Update tests to use llvm_asm!Amanieu d'Antras-2/+2
2020-03-20Auto merge of #69509 - RalfJung:debug-assert-write, r=eddybbors-6/+1
debug-assert ptr sanity in ptr::write This is a re-submission of the parts that we removed from https://github.com/rust-lang/rust/pull/69208 due to ["interesting" test failures](https://github.com/rust-lang/rust/pull/69208#issuecomment-591310437). Fixes https://github.com/rust-lang/rust/issues/53871 r? @Mark-Simulacrum @eddyb
2020-03-15Rollup merge of #69357 - tmiasko:debuginfo-column, r=michaelwoeristerDylan DPC-0/+40
Emit 1-based column numbers in debuginfo * Use byte offsets instead of char position offsets. Resolves #67360. * Use 1-based offsets instead of 0-based ones. Resolves #65437. * Consistently omit column information for msvc targets, matching clang behaviour (previously columns have been omitted from `DILocation`, but not from `DILexicalBlock`).
2020-03-14fix a codegen testRalf Jung-6/+1
2020-03-13Auto merge of #67502 - Mark-Simulacrum:opt-catch, r=Mark-Simulacrumbors-0/+39
Optimize catch_unwind to match C++ try/catch This refactors the implementation of catching unwinds to allow LLVM to inline the "try" closure directly into the happy path, avoiding indirection. This means that the catch_unwind implementation is (after this PR) zero-cost unless a panic is thrown. https://rust.godbolt.org/z/cZcUSB is an example of the current codegen in a simple case. Notably, the codegen is *exactly the same* if `-Cpanic=abort` is passed, which is clearly not great. This PR, on the other hand, generates the following assembly: ```asm # -Cpanic=unwind: push rbx mov ebx,0x2a call QWORD PTR [rip+0x1c53c] # <happy> mov eax,ebx pop rbx ret mov rdi,rax call QWORD PTR [rip+0x1c537] # cleanup function call call QWORD PTR [rip+0x1c539] # <unfortunate> mov ebx,0xd mov eax,ebx pop rbx ret # -Cpanic=abort: push rax call QWORD PTR [rip+0x20a1] # <happy> mov eax,0x2a pop rcx ret ``` Fixes #64224, and resolves #64222.
2020-03-13Auto merge of #69155 - chrissimpkins:llvm-globals, r=eddybbors-3/+3
Add support for LLVM globals corresponding to miri allocations should be named alloc123 Adds support for this request from @eddyb in #69134: > That is, if -Zfewer-names is false (usually only because of --emit=llvm-ir), we should use the same name for LLVM globals we generate out of miri allocs as #67133 does in MIR output (allocN). > >This way, we can easily see the mapping between MIR and LLVM IR (and it shouldn't be any costlier for regular compilation, which would continue to use unnamed globals). r? @eddyb cc @oli-obk
2020-03-12support LLVM globals corresponding to miri allocationsChris Simpkins-3/+3
2020-03-05debuginfo: Use is unsigned flag when emitting enumeratorsTomasz Miąsko-0/+27
2020-03-05Simplify the try intrinsic by using a callback in the catch blockAmanieu d'Antras-1/+4
2020-03-03Fix check for __msan_keep_going in sanitizer-recover testTomasz Miąsko-2/+2
Match `@__msan_keep_going = weak_odr constant i32 1`.
2020-03-02Test catch_unwind vanishingAmanieu d'Antras-0/+36
We execpt the try intrinsic to be a direct call if in -Cpanic=abort mode, and that catch_unwind optimizes out if calling a function that does not unwind.
2020-02-26Test that column information is not emitted for MSVC targetsTomasz Miąsko-0/+16