about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/mir
AgeCommit message (Collapse)AuthorLines
2025-06-03Change `tag_field` to `FieldIdx` in `Variants::Multiple`Scott McMurray-4/+4
It was already available as a generic parameter anyway, and it's not like we'll ever put a tag in the 5-billionth field.
2025-05-30Directly use from_immediate for handling boolbjorn3-3/+2
2025-05-30Avoid computing function type for intrinsic instancesbjorn3-8/+8
2025-05-30Use layout field of OperandRef and PlaceRef in codegen_intrinsic_callbjorn3-18/+13
This avoids having to get the function signature.
2025-05-28get rid of rustc_codegen_ssa::common::AtomicOrderingRalf Jung-13/+5
2025-05-28atomic_load intrinsic: use const generic parameter for orderingRalf Jung-34/+59
2025-05-26Reduce indentation in codegen_panic_intrinsicbjorn3-49/+47
2025-05-26Don't depend on FnAbi for intrinsicsbjorn3-32/+42
Intrinsics are not real functions and as such don't have any calling convention. Trying to compute a calling convention for an intrinsic anyway is a nonsensical operation.
2025-05-26Remove usage of FnAbi in codegen_intrinsic_callbjorn3-19/+9
2025-05-26Pass PlaceRef rather than Bx::Value to codegen_intrinsic_callbjorn3-4/+5
2025-05-26Move caller_location handling into codegen_intrinsic_callbjorn3-18/+20
2025-05-26Always use fn_span in codegen_call_terminatorbjorn3-15/+11
2025-05-26Move some code around in codegen_call_terminatorbjorn3-99/+103
2025-05-26Auto merge of #138489 - tmiasko:call-tmps-lifetime, r=workingjubileebors-13/+35
Describe lifetime of call argument temporaries passed indirectly Fixes #132014.
2025-05-24Auto merge of #141372 - khuey:ir_call_dbg_loc, r=jieyouxubors-0/+1
Use the fn_span when emitting function calls for better debug info. This especially improves the developer experience for long chains of function calls that span multiple lines, which is common with builder patterns, chains of iterator/future combinators, etc. try-job: armhf-gnu try-job: test-various try-job: x86_64-msvc-1 try-job: arm-android r? `@jieyouxu`
2025-05-22Use the fn_span when emitting function calls for better debug info.Kyle Huey-0/+1
This especially improves the developer experience for long chains of function calls that span multiple lines, which is common with builder patterns, chains of iterator/future combinators, etc.
2025-05-22Rename `kw::Empty` as `sym::empty`.Nicholas Nethercote-3/+3
Because the empty string is not a keyword.
2025-05-19Rollup merge of #140874 - mejrs:rads, r=WaffleLapkinStuart Cook-1/+1
make `rustc_attr_parsing` less dominant in the rustc crate graph It has/had a glob re-export of `rustc_attr_data_structures`, which is a crate much lower in the graph, and a lot of crates were using it *just* (or *mostly*) for that re-export, while they can rely on `rustc_attr_data_structures` directly. Previous graph: ![graph_1](https://github.com/user-attachments/assets/f4a5f13c-4222-4903-b56d-28c83511fcbd) Graph with this PR: ![graph_2](https://github.com/user-attachments/assets/1e053d9c-75cc-402b-84df-86229c98277a) The first commit keeps the re-export, and just changes the dependency if possible. The second commit is the "breaking change" which removes the re-export, and "explicitly" adds the `rustc_attr_data_structures` dependency where needed. It also switches over some src/tools/*. The second commit is actually a lot more involved than I expected. Please let me know if it's a better idea to back it out and just keep the first commit.
2025-05-18Remove rustc_attr_data_structures re-export from rustc_attr_parsingmejrs-1/+1
2025-05-17Describe lifetime of call argument temporaries passed indirectlyTomasz Miąsko-13/+35
2025-05-10Rollup merge of #140660 - RalfJung:more-order, r=WaffleLapkinMatthias Krüger-1/+0
remove 'unordered' atomic intrinsics As their doc comment already indicates, these operations do not currently have a place in our memory model. The intrinsics were introduced to support a hack in compiler-builtins, but that hack recently got removed (see https://github.com/rust-lang/compiler-builtins/issues/788).
2025-05-09remove 'unordered' atomic intrinsicsRalf Jung-1/+0
2025-05-05Resolve instance for SymFn in global/naked asmMichael Goulet-1/+3
2025-04-30Rollup merge of #134232 - bjorn3:naked_asm_improvements, r=wesleywiserMatthias Krüger-25/+32
Share the naked asm impl between cg_ssa and cg_clif This was introduced in https://github.com/rust-lang/rust/pull/128004.
2025-04-28AsyncDrop implementation using shim codegen of ↵Andrew Zhogin-7/+11
async_drop_in_place::{closure}, scoped async drop added.
2025-04-14Pass &mut self to codegen_global_asmbjorn3-1/+1
2025-04-14Make codegen_naked_asm publicbjorn3-2/+2
This allows it to be reused by codegen backends that don't use cg_ssa like cg_clif.
2025-04-14Pass MonoItemData to MonoItem::definebjorn3-6/+5
2025-04-14Move codegen_naked_asm call up into MonoItem::definebjorn3-7/+3
2025-04-14Make codegen_naked_asm retrieve the MIR Body itselfbjorn3-5/+6
2025-04-14Only require a CodegenCx for codegen_naked_asmbjorn3-9/+17
2025-04-14Don't begin defining a function when codegening a naked functionbjorn3-7/+7
While LLVM is rather permissive in this regards, some other codegen backends demand that once you declare a function for definition you actually define contents of the function, which doesn't happen for naked functions as we actually generate assembly for them.
2025-04-14Handle protected visibility in codegen_naked_asmbjorn3-4/+7
2025-04-14Use START_BLOCK in codegen_naked_asmbjorn3-2/+2
2025-04-10Auto merge of #139088 - spastorino:ergonomic-ref-counting-2, r=nikomatsakisbors-7/+72
Ergonomic ref counting: optimize away clones when possible This PR build on top of https://github.com/rust-lang/rust/pull/134797. It optimizes codegen of ergonomic ref-counting when the type being `use`d is only known to be copy after monomorphization. We avoid codening a clone and generate bitwise copy instead. RFC: https://github.com/rust-lang/rfcs/pull/3680 Tracking issue: https://github.com/rust-lang/rust/issues/132290 Project goal: https://github.com/rust-lang/rust-project-goals/issues/107 r? `@nikomatsakis` This PR could better sit on top of https://github.com/rust-lang/rust/pull/131650 but as it did not land yet I've decided to just do minimal changes. It may be the case that doing what I'm doing regress the performance and we may need to go the full route of https://github.com/rust-lang/rust/pull/131650. cc `@saethlin` in this regard.
2025-04-07Address PR feedbackScott McMurray-1/+3
2025-04-07Only clone mir body if tcx.features().ergonomic_clones()Santiago Pastorino-8/+10
2025-04-07Optimize codegen of use values that are copy post monomorphizationSantiago Pastorino-4/+66
2025-04-07Use a local var for tcxSantiago Pastorino-4/+5
2025-04-05Tell LLVM about impossible niche tagsScott McMurray-0/+28
2025-03-26Auto merge of #138601 - RalfJung:wasm-abi-fcw, r=alexcrichtonbors-2/+2
add FCW to warn about wasm ABI transition See https://github.com/rust-lang/rust/issues/122532 for context: the "C" ABI on wasm32-unk-unk will change. The goal of this lint is to warn about any function definition and calls whose behavior will be affected by the change. My understanding is the following: - scalar arguments are fine - including 128 bit types, they get passed as two `i64` arguments in both ABIs - `repr(C)` structs (recursively) wrapping a single scalar argument are fine (unless they have extra padding due to over-alignment attributes) - all return values are fine `@bjorn3` `@alexcrichton` `@Manishearth` is that correct? I am making this a "show up in future compat reports" lint to maximize the chances people become aware of this. OTOH this likely means warnings for most users of Diplomat so maybe we shouldn't do this? IIUC, wasm-bindgen should be unaffected by this lint as they only pass scalar types as arguments. Tracking issue: https://github.com/rust-lang/rust/issues/138762 Transition plan blog post: https://github.com/rust-lang/blog.rust-lang.org/pull/1531 try-job: dist-various-2
2025-03-25make -Zwasm-c-abi=legacy suppress the lintRalf Jung-2/+2
2025-03-25Auto merge of #138634 - saethlin:repeated-uninit, r=scottmcm,oli-obkbors-2/+19
Lower to a memset(undef) when Rvalue::Repeat repeats uninit Fixes https://github.com/rust-lang/rust/issues/138625. It is technically correct to just do nothing. But if we actually do nothing, we may miss that this is de-initializing something, so instead we just lower to a single memset that writes undef. This is still superior to the memcpy loop, in both quality of code we hand to the backend and LLVM's final output.
2025-03-24Auto merge of #133984 - DaniPopes:scmp-ucmp, r=scottmcmbors-0/+3
Lower BinOp::Cmp to llvm.{s,u}cmp.* intrinsics Lowers `mir::BinOp::Cmp` (`three_way_compare` intrinsic) to the corresponding LLVM `llvm.{s,u}cmp.i8.*` intrinsics. These are the intrinsics mentioned in https://github.com/rust-lang/rust/pull/118310, which are now available in LLVM 19. I couldn't find any follow-up PRs/discussions about this, please let me know if I missed something. r? `@scottmcm`
2025-03-19Lower to a memset(undef) when Rvalue::Repeat repeats uninitBen Kimock-2/+19
2025-03-17Flatten `if`s in `rustc_codegen_ssa`Yotam Ofek-28/+25
2025-03-16Rollup merge of #138549 - scottmcm:option-ssa, r=saethlin许杰友 Jieyou Xu (Joe)-1/+1
Fix the OperandRef type for NullOp::{UbChecks,ContractChecks} Stumbled on this while looking at something totally unrelated 🙃 r? saethlin
2025-03-15Fix the OperandRef type for NullOp::{UbChecks,ContractChecks}Scott McMurray-1/+1
2025-03-15Stop relying on rustc_type_ir in non-type-system cratesMichael Goulet-1/+1
2025-03-14Rollup merge of #138398 - RalfJung:atomic-intrinsics-provenance, r=nnethercoteJacob Pratt-4/+34
atomic intrinsics: clarify which types are supported and (if applicable) what happens with provenance The provenance semantics match what Miri implements and what the `AtomicPtr` API expects.