about summary refs log tree commit diff
path: root/src/test/codegen
AgeCommit message (Collapse)AuthorLines
2020-11-18Auto merge of #79106 - tmiasko:inline-hint, r=nagisa,eddybbors-0/+31
Fix setting inline hint based on `InstanceDef::requires_inline` For instances where `InstanceDef::requires_inline` is true, an attempt is made to set an inline hint though a call to the `inline` function. The attempt is ineffective, since all attributes will be usually removed by the second call. Fix the issue by applying the attributes only once, with user provided attributes having a priority when provided. Closes #79108.
2020-11-17Rollup merge of #78967 - tmiasko:codegen-tests, r=cuviperMara Bos-9/+17
Make codegen tests compatible with extra inlining
2020-11-17Fix setting inline hint based on `InstanceDef::requires_inline`Tomasz Miąsko-0/+31
For instances where `InstanceDef::requires_inline` is true, an attempt is made to set an inline hint though a call to the `inline` function. The attempt is ineffective, since all attributes will be usually removed by the second call. Fix the issue by applying the attributes only once, with user provided attributes having a priority when provided.
2020-11-14tweak new codegen test to work on localAshley Mannix-4/+4
2020-11-13remove const_generics from codegen testsAshley Mannix-4/+4
2020-11-12fully exploited the dropped support of LLVM 8DevJPM-2/+0
This commit grepped for LLVM_VERSION_GE, LLVM_VERSION_LT, get_major_version and min-llvm-version and statically evaluated every expression possible (and sensible) assuming that the LLVM version is >=9 now
2020-11-12Fix codegen test for issue 37945Tomasz Miąsko-6/+14
2020-11-12Ensure that closure call is not removed by MIR optimizations in a testTomasz Miąsko-1/+1
2020-11-12Fix test checking that into_boxed_slice does not panicTomasz Miąsko-2/+2
The memory allocation in vec might panic in the case of capacity overflow. Move the allocation outside the function to fix the test.
2020-11-08Support repr(simd) on ADTs containing a single array fieldgnzlbg-0/+91
This PR allows using `#[repr(simd)]` on ADTs containing a single array field: ```rust #[repr(simd)] struct S0([f32; 4]); #[repr(simd)] struct S1<const N: usize>([f32; N]); #[repr(simd)] struct S2<T, const N: usize>([T; N]); ``` This should allow experimenting with portable packed SIMD abstractions on nightly that make use of const generics.
2020-11-03Rollup merge of #77950 - arlosi:sha256, r=eddybMara Bos-0/+7
Add support for SHA256 source file hashing Adds support for `-Z src-hash-algorithm sha256`, which became available in LLVM 11. Using an older version of LLVM will cause an error `invalid checksum kind` if the hash algorithm is set to sha256. r? `@eddyb` cc #70401 `@est31`
2020-10-31Assert that locals have storage when usedTomasz Miąsko-0/+1
The validator in visit_local asserts that local has a stroage when used, but visit_local is never called so validation is ineffective. Use super_statement and super_terminator to ensure that locals are visited.
2020-10-26Auto merge of #77876 - tmiasko:simplify-locals, r=wesleywiserbors-6/+6
Remove unused set-discriminant statements and assignments regardless of rvalue * Represent use counts with u32 * Unify use count visitors * Change RemoveStatements visitor into a function * Remove unused set-discriminant statements * Use exhaustive match to clarify what is being optimized * Remove unused assignments regardless of rvalue kind
2020-10-26Auto merge of #68965 - eddyb:mir-inline-scope, r=nagisa,oli-obkbors-0/+17
rustc_mir: track inlined callees in SourceScopeData. We now record which MIR scopes are the roots of *other* (inlined) functions's scope trees, which allows us to generate the correct debuginfo in codegen, similar to what LLVM inlining generates. This PR makes the `ui` test `backtrace-debuginfo` pass, if the MIR inliner is turned on by default. Also, `#[track_caller]` is now correct in the face of MIR inlining (cc `@anp).` Fixes #76997. r? `@rust-lang/wg-mir-opt`
2020-10-26Ignore long lines in testoli-0/+1
2020-10-26Add an inlining debuginfo testoli-0/+16
2020-10-26simplify-locals: Remove unused assignments regardless of rvalue kindTomasz Miąsko-6/+6
2020-10-23Add codegen test for #45964Dániel Buga-0/+38
2020-10-20Rollup merge of #78046 - bugadani:issue-73827, r=nikicGuillaume Gomez-0/+18
Add codegen test for issue #73827 Closes #73827
2020-10-17Add codegen test for issue #73827Dániel Buga-0/+18
2020-10-15Prevent miscompilation in trivial loop {}Mark Rousskov-0/+15
Ideally, we would want to handle a broader set of cases to fully fix the underlying bug here. That is currently relatively expensive at compile and runtime, so we don't do that for now.
2020-10-14Add support for SHA256 source file hashing for LLVM 11+.Arlo Siemsen-0/+7
2020-10-13Auto merge of #76830 - Artoria2e5:tune, r=nagisabors-0/+21
Pass tune-cpu to LLVM I think this is how it should work... See https://internals.rust-lang.org/t/expose-tune-cpu-from-llvm/13088 for the background. Or the documentation diff.
2020-10-10Revert "Assume slice len is bounded by allocation size"Simonas Kazlauskas-24/+0
https://github.com/rust-lang/rust/pull/77023#issuecomment-703987379 suggests that the original PR introduced a significant perf regression. This reverts commit e44784b8750016a695361c990024750e037d8f9f / #77023.
2020-10-07Add codegen testAnthonyMikh-0/+35
2020-10-05Auto merge of #77466 - Aaron1011:reland-drop-tree, r=matthewjasperbors-3/+3
Re-land PR #71840 (Rework MIR drop tree lowering) PR https://github.com/rust-lang/rust/pull/71840 was reverted in https://github.com/rust-lang/rust/pull/72989 to fix an LLVM error (https://github.com/rust-lang/rust/issues/72470). That LLVM error no longer occurs with the recent upgrade to LLVM 11 (https://github.com/rust-lang/rust/pull/73526), so let's try re-landing this PR. I've cherry-picked the commits from the original PR (with the exception of the commit blessing test output), making as few modifications as possible. I addressed the rebase fallout in separate commits on top of those. r? `@matthewjasper`
2020-10-05Pass tune-cpu to LLVMMingye Wang-0/+21
I think this is how it should work...
2020-10-04Auto merge of #77023 - HeroicKatora:len-missed-optimization, r=Mark-Simulacrumbors-0/+24
Hint the maximum length permitted by invariant of slices One of the safety invariants of references, and in particular of references to slices, is that they may not cover more than `isize::MAX` bytes. The unsafe `from_raw_parts` constructors of slices explicitly requires the caller to guarantee this fact. Violating it would also be UB with regards to the semantics of generated llvm code. This effectively bounds the length of a (non-ZST) slice from above by a compile time constant. But when the length is loaded from a function argument it appears llvm is not aware of this requirement. The additional value range assertions allow some further elision of code branches, including overflow checks, especially in the presence of artithmetic on the indices. This may have a performance impact, adding more code to a common method but allowing more optimization. I'm not quite sure, is the Rust side of const-prop strong enough to elide the irrelevant match branches? Fixes: #67186
2020-10-04Assume slice len is bounded by allocation sizeAndreas Molzer-0/+24
Uses assume to check the length against a constant upper bound. The inlined result then informs the optimizer of the sound value range. This was tried with unreachable_unchecked before which introduces a branch. This has the advantage of not being executed in sound code but complicates basic blocks. It resulted in ~2% increased compile time in some worst cases. Add a codegen test for the assumption, testing the issue from #67186
2020-10-04Defer creating drop trees in MIR lowering until leaving that scopeMatthew Jasper-3/+3
2020-10-02Auto merge of #77396 - wesleywiser:disable-simplifyarmidentity, r=oli-obkbors-1/+1
Disable the SimplifyArmIdentity mir-opt The optimization still has some bugs that need to be worked out such as #77359. We can try re-enabling this again after the known issues are resolved. r? `@oli-obk`
2020-10-01Disable the SimplifyArmIdentity mir-optWesley Wiser-1/+1
The optimization still has some bugs that need to be worked out such as #77359. We can try re-enabling this again after the known issues are resolved.
2020-10-01Auto merge of #76971 - bugadani:issue-75659, r=Amanieubors-0/+63
Refactor memchr to allow optimization Closes #75659 The implementation already uses naive search if the slice if short enough, but the case is complicated enough to not be optimized away. This PR refactors memchr so that it exists early when the slice is short enough. Codegen-wise, as shown in #75659, memchr was not inlined previously so the only way I could find to test this is to check if there is no memchr call. Let me know if there is a more robust solution here.
2020-10-01Only test on x86_64Dániel Buga-0/+1
2020-09-27Refactor memchr to allow optimizationDániel Buga-0/+62
2020-09-26Add a test for 128-bit return valuesJonas Schievink-0/+32
2020-09-25Auto merge of #73453 - erikdesjardins:tuplayout, r=eddybbors-0/+79
Ignore ZST offsets when deciding whether to use Scalar/ScalarPair layout This is important because Scalar/ScalarPair layout previously would not be used if any ZST had nonzero offset. For example, before this change, only `((), u128)` would be laid out like `u128`, not `(u128, ())`. Fixes #63244
2020-09-21Rollup merge of #76961 - bugadani:test-34634, r=Mark-SimulacrumRalf Jung-0/+16
Add test for issue #34634 Closes #34634
2020-09-21Auto merge of #76295 - mati865:remove-mmx, r=Amanieu,oli-obkbors-27/+0
Remove MMX from Rust Follow-up to https://github.com/rust-lang/stdarch/pull/890 This removes most of MMX from Rust (tests pass with small changes), keeping stable `is_x86_feature_detected!("mmx")` working.
2020-09-20Remove MMX from RustMateusz Mikuła-27/+0
2020-09-20Add test for issue #34634Dániel Buga-0/+16
2020-09-20Make codegen test bitwidth-independentOliver Scherer-2/+2
2020-09-19Update codegen testsOliver Scherer-3/+3
2020-09-14Test that bounds checks are elided for indexing after .[r]position()Erik Desjardins-0/+78
2020-08-31Add codegen testsDániel Buga-0/+56
2020-08-30handle vector layoutErik Desjardins-0/+14
2020-08-30add codegen testErik Desjardins-0/+29
2020-08-30add tests related to tuple scalar layout with ZST in last fieldErik Desjardins-0/+36
2020-08-30Rollup merge of #75910 - bugadani:testcase, r=oli-obkDylan DPC-0/+22
Add test for issue #27130 #27130 seems to be fixed by the llvm 11 update. The issue is marked with needs-test, so here it is. As some historical context, the generated code was fine until 1.38, and remained unoptimized from 1.38 up until the current nightly. I've also added a pattern matching version that was fine on 1.45.2.
2020-08-28Make sure the functions don't get mergedDániel Buga-1/+1