summary refs log tree commit diff
path: root/tests/mir-opt/inline
AgeCommit message (Collapse)AuthorLines
2023-08-23Disable MIR SROA optimization by defaultWesley Wiser-64/+76
Turn off the MIR SROA optimization by default to prevent incorrect debuginfo generation and rustc ICEs caused by invalid LLVM IR being created. Related to #115113
2023-07-07Rename `adjustment::PointerCast` and variants using it to `PointerCoercion`Nilstrieb-8/+8
It makes it sound like the `ExprKind` and `Rvalue` are supposed to represent all pointer related casts, when in reality their just used to share a some enum variants. Make it clear there these are only coercion to make it clear why only some pointer related "casts" are in the enum.
2023-06-23Bless testsGary Guo-61/+61
2023-06-19Promote unchecked_add/sub/mul/shl/shr to mir::BinOpScott McMurray-64/+40
2023-06-19Auto merge of #112724 - scottmcm:simpler-unchecked-shifts, r=Mark-Simulacrumbors-8/+420
[libs] Simplify `unchecked_{shl,shr}` There's no need for the `const_eval_select` dance here. And while I originally wrote the `.try_into().unwrap_unchecked()` implementation here, it's kinda a mess in MIR -- this new one is substantially simpler, as shown by the old one being above the inlining threshold but the new one being below it in the `mir-opt/inline/unchecked_shifts` tests. We don't need `u32::checked_shl` doing a dance through both `Result` *and* `Option` 🙃
2023-06-17Auto merge of #100036 - DrMeepster:box_free_free_box, r=oli-obkbors-12/+17
Remove `box_free` lang item This PR removes the `box_free` lang item, replacing it with `Box`'s `Drop` impl. Box dropping is still slightly magic because the contained value is still dropped by the compiler.
2023-06-16[libs] Simplify `unchecked_{shl,shr}`Scott McMurray-8/+420
There's no need for the `const_eval_select` dance here. And while I originally wrote the `.try_into().unwrap_unchecked()` implementation here, it's kinda a mess in MIR -- this new one is substantially simpler, as shown by the old one being above the inlining threshold but the new one being below it.
2023-06-16remove box_free and replace with drop implDrMeepster-12/+17
2023-06-16Ignore the always part of #[inline(always)] in MIR inliningBen Kimock-929/+343
2023-06-15Remove comments from mir-opt MIR dumpsBen Kimock-2902/+2325
2023-06-12bless mir-optPietro Albini-7/+2060
To reproduce the changes in this commit locally: - Run `./x test tidy` and remove all the output files not associated with a test file anymore, as reported by tidy. - Run `./x test tests/mir-opt --bless` to generate the new outputs.
2023-06-12properly mark tests that require panic=abortPietro Albini-19/+20
2023-06-03Only check inlining counter after recusing.Camille GILLOT-43/+140
2023-05-31Enable ScalarReplacementOfAggregatesBen Kimock-216/+184
2023-05-28Auto merge of #111813 - scottmcm:pretty-mir, r=cjgillotbors-210/+210
MIR: opt-in normalization of `BasicBlock` and `Local` numbering This doesn't matter at all for actual codegen, but after spending some time reading pre-codegen MIR, I was wishing I didn't have to jump around so much in reading post-inlining code. So this add two passes that are off by default for every mir level, but can be enabled (`-Zmir-enable-passes=+ReorderBasicBlocks,+ReorderLocals`) for humans.
2023-05-21Normalize block and local orders in mir-opt testsScott McMurray-210/+210
Since this only affects `PreCodegen MIR, and it would be nice for that to be resilient to permutations of things that don't affect the actual semantic behaviours.
2023-05-20Don't inline functions with unsized argsJakob Degen-0/+65
2023-05-14Merge return place with other locals in CopyProp.Camille GILLOT-86/+468
2023-05-08Disable nrvo mir optJakob Degen-468/+86
2023-04-23Auto merge of #110705 - saethlin:ignore-locals-cost, r=cjgillotbors-48/+450
Remove the size of locals heuristic in MIR inlining This heuristic doesn't necessarily correlate to complexity of the MIR Body. In particular, a lot of straight-line code in MIR tends to never reuse a local, even though any optimizer would effectively reuse the storage or just put everything in registers. So it doesn't even necessarily make sense that this would be a stack size heuristic. So... what happens if we just delete the heuristic? The benchmark suite improves significantly. Less heuristics better? r? `@cjgillot`
2023-04-22Remove the size of locals heuristic in MIR inliningBen Kimock-48/+450
2023-04-22Turn on ConstDebugInfo pass.Wesley Wiser-1/+1
2023-04-20Run combine_duplicate_switch_targets after the simplification that produces themBen Kimock-1/+1
2023-04-17fix codegen differenceDeadbeef-26/+66
2023-04-17bless mir-optDeadbeef-438/+28
2023-04-07./x.py test --blessTomasz MiÄ…sko-182/+296
2023-04-06Ignore many tests on wasm32Gary Guo-108/+118
2023-04-06Bless testsGary Guo-24/+24
2023-04-05Bless testsThom Chiovoloni-11/+8
2023-03-31Auto merge of #98112 - saethlin:mir-alignment-checks, r=oli-obkbors-4/+5
Insert alignment checks for pointer dereferences when debug assertions are enabled Closes https://github.com/rust-lang/rust/issues/54915 - [x] Jake tells me this sounds like a place to use `MirPatch`, but I can't figure out how to insert a new basic block with a new terminator in the middle of an existing basic block, using `MirPatch`. (if nobody else backs up this point I'm checking this as "not actually a good idea" because the code looks pretty clean to me after rearranging it a bit) - [x] Using `CastKind::PointerExposeAddress` is definitely wrong, we don't want to expose. Calling a function to get the pointer address seems quite excessive. ~I'll see if I can add a new `CastKind`.~ `CastKind::Transmute` to the rescue! - [x] Implement a more helpful panic message like slice bounds checking. r? `@oli-obk`
2023-03-25Ignore the unwrap_unchecked test on wasm32-unknown-unknownBen Kimock-3/+4
2023-03-23A MIR transform that checks pointers are alignedBen Kimock-4/+5
2023-03-18Enable inlining of diverging functionsBen Kimock-0/+557
2023-03-13Generalize operation.Camille GILLOT-58/+58
2023-03-13Replace ZST operands and debuginfo by constants.Camille GILLOT-31/+29
2023-03-12Remove uses of `box_syntax` in rustc and toolsclubby789-59/+55
2023-03-02Revert "Stabilize `#![feature(target_feature_11)]`"Léo Lanteri Thauvin-7/+8
This reverts commit b379d216eefaba083a0627b1724d73f99d4bdf5c.
2023-02-28Auto merge of #99767 - LeSeulArtichaut:stable-target-feature-11, r=estebankbors-8/+7
Stabilize `#![feature(target_feature_11)]` ## Stabilization report ### Summary Allows for safe functions to be marked with `#[target_feature]` attributes. Functions marked with `#[target_feature]` are generally considered as unsafe functions: they are unsafe to call, cannot be assigned to safe function pointers, and don't implement the `Fn*` traits. However, calling them from other `#[target_feature]` functions with a superset of features is safe. ```rust // Demonstration function #[target_feature(enable = "avx2")] fn avx2() {} fn foo() { // Calling `avx2` here is unsafe, as we must ensure // that AVX is available first. unsafe { avx2(); } } #[target_feature(enable = "avx2")] fn bar() { // Calling `avx2` here is safe. avx2(); } ``` ### Test cases Tests for this feature can be found in [`src/test/ui/rfcs/rfc-2396-target_feature-11/`](https://github.com/rust-lang/rust/tree/b67ba9ba208ac918228a18321fc3a11a99b1c62b/src/test/ui/rfcs/rfc-2396-target_feature-11/). ### Edge cases - https://github.com/rust-lang/rust/issues/73631 Closures defined inside functions marked with `#[target_feature]` inherit the target features of their parent function. They can still be assigned to safe function pointers and implement the appropriate `Fn*` traits. ```rust #[target_feature(enable = "avx2")] fn qux() { let my_closure = || avx2(); // this call to `avx2` is safe let f: fn() = my_closure; } ``` This means that in order to call a function with `#[target_feature]`, you must show that the target-feature is available while the function executes *and* for as long as whatever may escape from that function lives. ### Documentation - Reference: https://github.com/rust-lang/reference/pull/1181 --- cc tracking issue #69098 r? `@ghost`
2023-02-16Enable instcombine for mutable reborrowsBen Kimock-18/+6
2023-02-12Enable CopyProp by default, tune the impl a bitBen Kimock-34/+26
2023-02-02Bless tests.Camille GILLOT-33/+58
2023-02-02Stop deaggregating enums in MIR.Camille GILLOT-6/+2
2023-02-01Stabilize `#![feature(target_feature_11)]`Léo Lanteri Thauvin-8/+7
2023-01-27Implement SSA CopyProp pass.Camille GILLOT-7/+7
2023-01-14Make the inlining destination a `Local`.Camille GILLOT-7/+68
2023-01-14Add test.Camille GILLOT-0/+22
2023-01-11Move /src/test to /testsAlbert Larsan-0/+2644