about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/mir
AgeCommit message (Collapse)AuthorLines
2022-10-14Allow dyn* upcastingMichael Goulet-21/+6
2022-10-13Rollup merge of #102641 - eholk:dyn-star-box, r=compiler-errorsYuki Okushi-0/+9
Support casting boxes to dyn* Boxes have a pointer type at codegen time which LLVM does not allow to be transparently converted to an integer. Work around this by inserting a `ptrtoint` instruction if the argument is a pointer. r? ``@compiler-errors`` Fixes #102427
2022-10-12Add a fixmeEric Holk-0/+3
2022-10-07Cast vtable type tooEric Holk-0/+1
2022-10-06Remove `mir::CastKind::Misc`ouz-a-2/+8
2022-10-04Support casting boxes to dyn*Eric Holk-0/+5
2022-10-02Remove type argument of array_alloca and rename to byte_array_allocabjorn3-1/+1
2022-10-01Merge apply_attrs_callsite into call and invokebjorn3-7/+11
Some codegen backends are not able to apply callsite attrs after the fact.
2022-09-20Auto merge of #99806 - oli-obk:unconstrained_opaque_type, r=estebankbors-0/+16
Allow patterns to constrain the hidden type of opaque types fixes #96572 reverts a revert as original PR was a perf regression that was fixed by reverting it: https://github.com/rust-lang/rust/pull/99368#issuecomment-1186587864) TODO: * check if https://github.com/rust-lang/rust/issues/99685 is avoided
2022-09-17Auto merge of #98588 - b-naber:valtrees-cleanup, r=lcnrbors-18/+18
Use only ty::Unevaluated<'tcx, ()> in type system r? `@lcnr`
2022-09-16Revert "Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, ↵Oli Scherer-0/+16
r=estebank"" This reverts commit 4a742a691e7dd2522bad68b86fe2fd5a199d5561.
2022-09-14Auto merge of #101212 - eholk:dyn-star, r=compiler-errorsbors-2/+103
Initial implementation of dyn* This PR adds extremely basic and incomplete support for [dyn*](https://smallcultfollowing.com/babysteps//blog/2022/03/29/dyn-can-we-make-dyn-sized/). The goal is to get something in tree behind a flag to make collaboration easier, and also to make sure the implementation so far is not unreasonable. This PR does quite a few things: * Introduce `dyn_star` feature flag * Adds parsing for `dyn* Trait` types * Defines `dyn* Trait` as a sized type * Adds support for explicit casts, like `42usize as dyn* Debug` * Including const evaluation of such casts * Adds codegen for drop glue so things are cleaned up properly when a `dyn* Trait` object goes out of scope * Adds codegen for method calls, at least for methods that take `&self` Quite a bit is still missing, but this gives us a starting point. Note that this is never intended to become stable surface syntax for Rust, but rather `dyn*` is planned to be used as an implementation detail for async functions in dyn traits. Joint work with `@nikomatsakis` and `@compiler-errors.` r? `@bjorn3`
2022-09-13Address code review commentsEric Holk-1/+1
2022-09-13use ty::Unevaluated<'tcx, ()> in type systemb-naber-18/+18
2022-09-13Auto merge of #99556 - davidtwco:collapse-debuginfo, r=wesleywiserbors-4/+4
ssa: implement `#[collapse_debuginfo]` cc #39153 rust-lang/compiler-team#386 Debuginfo line information for macro invocations are collapsed by default - line information are replaced by the line of the outermost expansion site. Using `-Zdebug-macros` disables this behaviour. When the `collapse_debuginfo` feature is enabled, the default behaviour is reversed so that debuginfo is not collapsed by default. In addition, the `#[collapse_debuginfo]` attribute is available and can be applied to macro definitions which will then have their line information collapsed. r? rust-lang/wg-debugging
2022-09-12Make dyn-trait-method workMichael Goulet-1/+24
2022-09-12Rename some variantsMichael Goulet-4/+4
2022-09-12Construct dyn* during const interpMichael Goulet-1/+1
2022-09-12Use principal of cast target as dyn-star trait ref in codegenMichael Goulet-7/+6
2022-09-12Call destructors when dyn* object goes out of scopeEric Holk-5/+32
2022-09-12dyn* through more typechecking and MIREric Holk-2/+54
2022-09-10Auto merge of #101483 - oli-obk:guaranteed_opt, r=fee1-deadbors-6/+2
The `<*const T>::guaranteed_*` methods now return an option for the unknown case cc https://github.com/rust-lang/rust/issues/53020#issuecomment-1236932443 I chose `0` for "not equal" and `1` for "equal" and left `2` for the unknown case so backends can just forward to raw pointer equality and it works ✨ r? `@fee1-dead` or `@lcnr` cc `@rust-lang/wg-const-eval`
2022-09-09The `<*const T>::guaranteed_*` methods now return an option for the unknown caseOli Scherer-6/+2
2022-09-09Use memset when repeating 128bit zero valueTomasz Miąsko-1/+1
2022-09-07Change name of "dataful" variant to "untagged"Michael Benfield-4/+4
This is in anticipation of a new enum layout, in which the niche optimization may be applied even when multiple variants have data.
2022-09-07ssa: implement `#[collapse_debuginfo]`David Wood-4/+4
Debuginfo line information for macro invocations are collapsed by default - line information are replaced by the line of the outermost expansion site. Using `-Zdebug-macros` disables this behaviour. When the `collapse_debuginfo` feature is enabled, the default behaviour is reversed so that debuginfo is not collapsed by default. In addition, the `#[collapse_debuginfo]` attribute is available and can be applied to macro definitions which will then have their line information collapsed. Signed-off-by: David Wood <david.wood@huawei.com>
2022-09-07Auto merge of #98332 - oli-obk:assume, r=wesleywiserbors-9/+9
Lower the assume intrinsic to a MIR statement This makes https://github.com/rust-lang/rust/pull/96862#issuecomment-1153739068 easier and will generally allow us to cheaply insert assume intrinsic calls in mir building. r? rust-lang/wg-mir-opt
2022-09-06Generalize the Assume intrinsic statement to a general Intrinsic statementOli Scherer-10/+9
2022-09-06Lower the assume intrinsic to a MIR statementOli Scherer-4/+5
2022-09-06Remove dead broken code from const zst handling in backendsOli Scherer-8/+1
2022-09-04Make `const_eval_select` a real intrinsicDeadbeef-2/+1
2022-09-01Auto merge of #100958 - mikebenfield:workaround, r=nikicbors-11/+0
compiler/rustc_codegen_ssa/src/mir/place.rs: Remove LLVM bug workaround This memset was inserted as a workaround to Rust issue #34427, which was an LLVM bug that apparently no longer manifests.
2022-08-31Fix a bunch of typoDezhi Wu-1/+1
This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-29Rollup merge of #99027 - tmiasko:basic-blocks, r=oli-obkMatthias Krüger-7/+7
Replace `Body::basic_blocks()` with field access Since the refactoring in #98930, it is possible to borrow the basic blocks independently from other parts of MIR by accessing the `basic_blocks` field directly. Replace unnecessary `Body::basic_blocks()` method with a direct field access, which has an additional benefit of borrowing the basic blocks only.
2022-08-26Replace `Body::basic_blocks()` with field accessTomasz Miąsko-7/+7
2022-08-26Move `ArgAbi::pad_i32` into `PassMode::Cast`.Nicholas Nethercote-22/+18
Because it's only needed for that variant. This shrinks the types and clarifies the logic.
2022-08-26Turn `ArgAbi::pad` into a `bool`.Nicholas Nethercote-5/+5
Because it's only ever set to `None` or `Some(Reg::i32())`.
2022-08-26Box `CastTarget` within `PassMode`.Nicholas Nethercote-6/+6
Because `PassMode::Cast` is by far the largest variant, but is relatively rare. This requires making `PassMode` not impl `Copy`, and `Clone` is no longer necessary. This causes lots of sigil adjusting, but nothing very notable.
2022-08-24Remove LLVM ARM bug workaroundMichael Benfield-11/+0
This memset was inserted as a workaround to Rust issue #34427, which was an LLVM bug that apparently no longer manifests.
2022-08-22Refactor part of codegen_call_terminatorEric Holk-47/+44
2022-07-26Rollup merge of #97077 - ouz-a:Optimize-backend, r=oli-obkYuki Okushi-9/+3
Simplify some code that depend on Deref Now that we can assume #97025 works, it's safe to expect Deref is always in the first place of projections. With this, I was able to simplify some code that depended on Deref's place in projections. When we are able to move Derefer before `ElaborateDrops` successfully we will be able to optimize more places. r? `@oli-obk`
2022-07-24Auto merge of #95548 - rcvalle:rust-cfi-2, r=nagisabors-10/+2
Add fine-grained LLVM CFI support to the Rust compiler This PR improves the LLVM Control Flow Integrity (CFI) support in the Rust compiler by providing forward-edge control flow protection for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types. Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by identifying C char and integer type uses at the time types are encoded (see Type metadata in the design document in the tracking issue https://github.com/rust-lang/rust/issues/89653). LLVM CFI can be enabled with -Zsanitizer=cfi and requires LTO (i.e., -Clto). Thank you again, `@eddyb,` `@nagisa,` `@pcc,` and `@tmiasko` for all the help!
2022-07-23Add fine-grained LLVM CFI support to the Rust compilerRamon de C Valle-10/+2
This commit improves the LLVM Control Flow Integrity (CFI) support in the Rust compiler by providing forward-edge control flow protection for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types. Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by identifying C char and integer type uses at the time types are encoded (see Type metadata in the design document in the tracking issue #89653). LLVM CFI can be enabled with -Zsanitizer=cfi and requires LTO (i.e., -Clto).
2022-07-22simplify more, ret_deref -> has_derefouz-a-2/+1
2022-07-22simplify some code that depend on Derefouz-a-8/+3
2022-07-22Rollup merge of #98868 - tmiasko:unreachable-coverage, r=wesleywiserDylan DPC-5/+2
Fix unreachable coverage generation for inlined functions To generate a function coverage we need at least one coverage counter, so a coverage from unreachable blocks is retained only when some live counters remain. The previous implementation incorrectly retained unreachable coverage, because it didn't account for the fact that those live counters can belong to another function due to inlining. Fixes #98833.
2022-07-20various nits from reviewRalf Jung-1/+4
2022-07-20add range metadata to alignment loadsRalf Jung-2/+7
2022-07-20Move vtable_size and vtable_align impls to cg_ssabjorn3-0/+10
2022-07-20Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank"Oli Scherer-16/+0
This reverts commit 6f8fb911ad504b77549cf3256a09465621beab9d, reversing changes made to 7210e46dc69a4b197a313d093fe145722c248b7d.