about summary refs log tree commit diff
path: root/src/librustc_codegen_ssa
AgeCommit message (Collapse)AuthorLines
2020-05-06Rollup merge of #71269 - Mark-Simulacrum:sat-float-casts, r=nikicDylan DPC-1/+1
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-1/+1
- 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-04Auto merge of #71754 - alexcrichton:no-bitcode-in-cache, r=nnethercotebors-21/+6
Don't copy bytecode files into the incr. comp. cache. It's no longer necessary now that bitcode is embedded into object files. This change meant that `WorkProductFileKind::Bytecode` is no longer necessary, which means that type is no longer necessary, which allowed several places in the code to become simpler. This commit was written by @nnethercote in https://github.com/rust-lang/rust/pull/70458 but that didn't land. In the meantime though we managed to land it in https://github.com/rust-lang/rust/pull/71528 and that doesn't seem to be causing too many fires, so I'm re-sending this patch!
2020-05-03Add `MutatingUseContext::Yield`Dylan MacKenzie-1/+2
...emulating `MutatingUseContext::Call`
2020-05-02Rollup merge of #71787 - tshepang:rustdoc-warnings, r=varkorDylan DPC-1/+1
fix rustdoc warnings
2020-05-02Rollup merge of #71777 - petrochenkov:crtype, r=Mark-SimulacrumDylan DPC-52/+49
cleanup: `config::CrateType` -> `CrateType`
2020-05-02Rollup merge of #71772 - cjgillot:ensure, r=petrochenkovDylan DPC-1/+1
Mark query function as must_use. And use the `ensure()` version when the result is not needed.
2020-05-02cleanup: `config::CrateType` -> `CrateType`Vadim Petrochenkov-52/+49
2020-05-02fix rustdoc warningsTshepang Lekhonkhobe-1/+1
2020-05-02Auto merge of #71716 - alexcrichton:bitcode-follow-up, r=nnethercotebors-2/+2
Rename `bitcode-in-rlib` option to `embed-bitcode` This commit finishes work first pioneered in #70458 and started in #71528. The `-C bitcode-in-rlib` option, which has not yet reached stable, is renamed to `-C embed-bitcode` since that more accurately reflects what it does now anyway. Various tests and such are updated along the way as well. This'll also need to be backported to the beta channel to ensure we don't accidentally stabilize `-Cbitcode-in-rlib` as well.
2020-05-01Rollup merge of #71747 - spastorino:safety-scheme-around-consts-cleanup, ↵Dylan DPC-19/+3
r=oli-obk Remove deadcode in eval_mir_constant_to_operand r? @oli-obk @RalfJung
2020-05-01Rename `bitcode-in-rlib` option to `embed-bitcode`Alex Crichton-2/+2
This commit finishes work first pioneered in #70458 and started in #71528. The `-C bitcode-in-rlib` option, which has not yet reached stable, is renamed to `-C embed-bitcode` since that more accurately reflects what it does now anyway. Various tests and such are updated along the way as well. This'll also need to be backported to the beta channel to ensure we don't accidentally stabilize `-Cbitcode-in-rlib` as well.
2020-05-01Mark query function as must_use.Camille GILLOT-1/+1
2020-05-01Don't copy bytecode files into the incr. comp. cache.Nicholas Nethercote-21/+6
It's no longer necessary now that bitcode is embedded into object files. This change meant that `WorkProductFileKind::Bytecode` is no longer necessary, which means that type is no longer necessary, which allowed several places in the code to become simpler.
2020-05-01Remove deadcode in eval_mir_constant_to_operandSantiago Pastorino-19/+3
2020-05-01Auto merge of #71623 - petrochenkov:localink, r=estebankbors-1/+16
Disable localization for all linkers We previously disabled non-English output from `link.exe` due to encoding issues (#35785). In https://github.com/rust-lang/rust/pull/70740 it was pointed out that it also prevents correct inspection of the linker output, which we have to do occasionally. So this PR disables localization for all linkers.
2020-05-01Auto merge of #70674 - cjgillot:query-arena-all, r=matthewjasperbors-9/+6
Have the per-query caches store the results on arenas This PR leverages the cache for each query to serve as storage area for the query results. It introduces a new cache `ArenaCache`, which moves the result to an arena, and only stores the reference in the hash map. This allows to remove a sizeable part of the usage of the global `TyCtxt` arena. I only migrated queries that already used arenas before.
2020-04-30Auto merge of #70175 - Amanieu:remove_nlp, r=pnkfelixbors-2/+2
Remove -Z no-landing-pads flag Since #67502, `-Z no-landing-pads` will cause all attempted unwinds to abort since we don't generate a `try` / `catch`. This previously worked because `__rust_try` was located in libpanic_unwind which is always compiled with `-C panic=unwind`, but `__rust_try` is now directly inline into the crate that uses `catch_unwind`. As such, `-Z no-landing-pads` is now mostly useless and people should use `-C panic=abort` instead.
2020-04-29Auto merge of #71528 - alexcrichton:no-more-bitcode, r=nnethercotebors-65/+7
Store LLVM bitcode in object files, not compressed This commit is an attempted resurrection of #70458 where LLVM bitcode emitted by rustc into rlibs is stored into object file sections rather than in a separate file. The main rationale for doing this is that when rustc emits bitcode it will no longer use a custom compression scheme which makes it both easier to interoperate with existing tools and also cuts down on compile time since this compression isn't happening. The blocker for this in #70458 turned out to be that native linkers didn't handle the new sections well, causing the sections to either trigger bugs in the linker or actually end up in the final linked artifact. This commit attempts to address these issues by ensuring that native linkers ignore the new sections by inserting custom flags with module-level inline assembly. Note that this does not currently change the API of the compiler at all. The pre-existing `-C bitcode-in-rlib` flag is co-opted to indicate whether the bitcode should be present in the object file or not. Finally, note that an important consequence of this commit, which is also one of its primary purposes, is to enable rustc's `-Clto` bitcode loading to load rlibs produced with `-Clinker-plugin-lto`. The goal here is that when you're building with LTO Cargo will tell rustc to skip codegen of all intermediate crates and only generate LLVM IR. Today rustc will generate both object code and LLVM IR, but the object code is later simply thrown away, wastefully.
2020-04-29Store LLVM bitcode in object files, not compressedAlex Crichton-65/+7
This commit is an attempted resurrection of #70458 where LLVM bitcode emitted by rustc into rlibs is stored into object file sections rather than in a separate file. The main rationale for doing this is that when rustc emits bitcode it will no longer use a custom compression scheme which makes it both easier to interoperate with existing tools and also cuts down on compile time since this compression isn't happening. The blocker for this in #70458 turned out to be that native linkers didn't handle the new sections well, causing the sections to either trigger bugs in the linker or actually end up in the final linked artifact. This commit attempts to address these issues by ensuring that native linkers ignore the new sections by inserting custom flags with module-level inline assembly. Note that this does not currently change the API of the compiler at all. The pre-existing `-C bitcode-in-rlib` flag is co-opted to indicate whether the bitcode should be present in the object file or not. Finally, note that an important consequence of this commit, which is also one of its primary purposes, is to enable rustc's `-Clto` bitcode loading to load rlibs produced with `-Clinker-plugin-lto`. The goal here is that when you're building with LTO Cargo will tell rustc to skip codegen of all intermediate crates and only generate LLVM IR. Today rustc will generate both object code and LLVM IR, but the object code is later simply thrown away, wastefully.
2020-04-29Remove Session::no_landing_pads()Amanieu d'Antras-2/+2
2020-04-28Use the query system to allocate.Camille GILLOT-9/+6
2020-04-27Change return type of `entry_fn` query to return a `LocalDefId`marmeladema-3/+3
2020-04-27Disable localization for all linkersVadim Petrochenkov-1/+16
2020-04-26codegen_llvm: Simplify logic for relaxing PIC into PIEVadim Petrochenkov-5/+1
2020-04-26rustc_target: Stop using "string typing" for relocation modelsVadim Petrochenkov-11/+2
Introduce `enum RelocModel` instead.
2020-04-26Rollup merge of #71392 - ecstatic-morse:body-predecessor-cache-arc, ↵Dylan DPC-1/+1
r=nikomatsakis Don't hold the predecessor cache lock longer than necessary #71044 returns a `LockGuard` with the predecessor cache to callers of `Body::predecessors`. As a result, the lock around the predecessor cache could be held for an arbitrarily long time. This PR uses reference counting for ownership of the predecessor cache, meaning the lock is only ever held within `PredecessorCache::compute`. Checking this API for potential sources of deadlock is much easier now, since we no longer have to consider its consumers, only its internals. This required removing `predecessors_for`, since there is no equivalent to `LockGuard::map` for `Arc` and `Rc`. I believe this could be emulated with `owning_ref::{Arc,Rc}Ref`, but I don't think it's necessary. Also, we continue to return an opaque type from `Body::predecessors` with the lifetime of the `Body`, not `'static`. This depends on #71044. Only the last two commits are new. r? @nikomatsakis
2020-04-25Rollup merge of #71544 - cuviper:filter_map_next, r=Mark-SimulacrumDylan DPC-5/+1
Replace filter_map().next() calls with find_map() These are semantically the same, but `find_map()` is more concise.
2020-04-25Rollup merge of #71364 - Amanieu:zprofile_compiler_builtins, r=cramertjDylan DPC-5/+18
Ignore -Zprofile when building compiler_builtins #70846 made the `compiler_builtins` crate ignore the default codegen-units setting and instead always split each function into a different codegen unit. This unfortunately breaks `-Zprofile` which requires a single codegen unit per crate (see #71283). You can notice this when building with `cargo -Zbuild-std` and `RUSTFLAGS` containing `-Zprofile`. This PR works around this issue by just ignoring `-Zprofile` for the `compiler-builtins` crate.
2020-04-24Replace filter_map().next() calls with find_map()Josh Stone-5/+1
These are semantically the same, but `find_map()` is more concise.
2020-04-24Auto merge of #70820 - spastorino:replace-fragile-erroneous-const-sys, r=oli-obkbors-0/+14
Replace fragile erroneous const sys Closes #67191 r? @oli-obk
2020-04-23Modify `as_local_hir_id` to return a bare `HirId`marmeladema-1/+1
2020-04-23Modify `as_local_hir_id` to accept a `LocalDefId` instead of a `DefId`marmeladema-2/+2
2020-04-23librustc_middle: return LocalDefId instead of DefId in local_def_idmarmeladema-5/+5
2020-04-23Rename uneval_consts to required_constsSantiago Pastorino-1/+1
2020-04-23Evaluate unevaluated MIR constants in codegen_mirSantiago Pastorino-0/+14
2020-04-22Remove `predecessors_for`Dylan MacKenzie-1/+1
There is no `Arc::map` equivalent to `LockGuard::map`
2020-04-22Auto merge of #71044 - ecstatic-morse:body-predecessor-cache, r=oli-obkbors-15/+14
Remove `BodyAndCache` ...returning to the original approach using interior mutability within `Body`. This simplifies the API at the cost of some uncontended mutex locks when the parallel compiler is enabled. The current API requires you to either have a mutable reference to `Body` (`&mut BodyAndCache`), or to compute the predecessor graph ahead of time by creating a `ReadOnlyBodyAndCache`. This is not a good fit for, e.g., the dataflow framework, which 1. does not mutate the MIR 2. only sometimes needs the predecessor graph (for backward dataflow problems)
2020-04-22Use `Body` everywhereDylan MacKenzie-8/+7
2020-04-22Don't use `*` for deref-coercionDylan MacKenzie-7/+7
2020-04-22Rollup merge of #71401 - spastorino:remove-visit-place-base, r=wesleywiserDylan DPC-1/+1
visit_place_base is just visit_local r? @wesleywiser
2020-04-22Auto merge of #71424 - Dylan-DPC:rollup-iunh61a, r=Dylan-DPCbors-0/+2
Rollup of 6 pull requests Successful merges: - #70970 (Detect mistyped associated consts in `Instance::resolve`.) - #71203 (Correct await span for async-await error reporting) - #71214 (Add error code for inner doc error) - #71337 (Moving all rustdoc-ui tests to check-pass) - #71412 (Clarify unused_doc_comments note on macro invocations) - #71414 (More diagnostic items for Clippy usage) Failed merges: r? @ghost
2020-04-22Rollup merge of #70970 - eddyb:trait-vs-impl-mismatch, r=oli-obkDylan DPC-0/+2
Detect mistyped associated consts in `Instance::resolve`. *Based on #71049 to prevent redundant/misleading downstream errors.* Fixes #70942 by refusing to resolve an associated `const` if it doesn't have the same type in the `impl` that it does in the `trait` (which we assume had errored, and `delay_span_bug` guards against bugs).
2020-04-22Auto merge of #71323 - nnethercote:bitcode-in-rlib, r=alexcrichtonbors-1/+2
Add `-Cbitcode-in-rlib`. This is a cut-down version of #70458 that gets the compile-time wins. r? @alexcrichton
2020-04-22Add a new option `-Cbitcode-in-rlib`.Nicholas Nethercote-1/+2
It defaults to true, but Cargo will set this to false whenever it can to reduce compile times.
2020-04-22Rollup merge of #71236 - sinkuu:cleanup, r=nikomatsakisYuki Okushi-1/+0
Remove unused rustc_serialize::hex module * Remove unused `rustc_serialize::hex` module * Cleanup `Cargo.toml`
2020-04-21visit_place_base is just visit_localSantiago Pastorino-1/+1
2020-04-20Ignore -Zprofile when building compiler_builtinsAmanieu d'Antras-5/+18
2020-04-20Auto merge of #70729 - nnethercote:a-big-options-clean-up, r=petrochenkovbors-19/+6
A big options clean-up Lots of improvements here. r? @Centril
2020-04-20Remove unused dependenciesShotaro Yamada-1/+0