Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 13 pull requests #136998

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3c7c38a
Simplify SSE2 implementation
real-eren Feb 2, 2025
d6ca7ad
Remove dead control char logic
real-eren Feb 3, 2025
4b086d4
expect EINVAL for pthread_mutex_destroy for aix
mustartt Feb 12, 2025
88193aa
Use the right binder for rebinding PolyTraitRef
compiler-errors Feb 12, 2025
9c03369
add `IntoBounds` trait
pitaj Feb 12, 2025
51b105d
ignore vendor directory in `git status`
jyn514 Feb 13, 2025
1a3efd2
Use `slice::fill` in `io::Repeat` implementation
DaniPopes Feb 13, 2025
d7eca8a
Trace execution of bootstrap commands
Kobzol Feb 12, 2025
447a6a0
Add export of bootstrap tracing to Chrome events
Kobzol Feb 12, 2025
521cbd3
Document bootstrap profiling
Kobzol Feb 12, 2025
ce9bf4a
Move all alloc integration tests to a new alloctests crate
bjorn3 Feb 6, 2025
4a01dcc
Move most Rc tests to alloctests
bjorn3 Feb 6, 2025
8c9fee0
Move last remaining Rc test to alloctests
bjorn3 Feb 6, 2025
69ac9fc
Fully test the alloc crate through alloctests
bjorn3 Feb 6, 2025
1726670
Add comments
bjorn3 Feb 13, 2025
2f27236
alloc boxed: docs: use MaybeUninit::write instead of as_mut_ptr
jedbrown Feb 13, 2025
fc5ff7f
ci: switch loongarch jobs to free runners
marcoieni Feb 13, 2025
2966256
Make `-O` mean `-C opt-level=3`
clubby789 Jan 13, 2025
06524b5
Update backtrace
ehuss Feb 13, 2025
bfdc961
[cg_llvm] Remove dead error message
dpaoliello Feb 13, 2025
c3e21a2
Rollup merge of #135439 - clubby789:O3, r=Noratrieb
workingjubilee Feb 14, 2025
c248fef
Rollup merge of #136460 - real-eren:simplify-rustc_span-analyze, r=No…
workingjubilee Feb 14, 2025
70fd4ec
Rollup merge of #136642 - bjorn3:separate_alloctest_crate, r=cuviper
workingjubilee Feb 14, 2025
b44251d
Rollup merge of #136904 - pitaj:range-into_bounds, r=tgross35
workingjubilee Feb 14, 2025
c7b4e2e
Rollup merge of #136908 - mustartt:aix-mutex-destory-einval, r=joboet
workingjubilee Feb 14, 2025
eb6587c
Rollup merge of #136924 - Kobzol:bootstrap-tracing, r=jieyouxu
workingjubilee Feb 14, 2025
ed4a63b
Rollup merge of #136951 - compiler-errors:clause-binder, r=lqd
workingjubilee Feb 14, 2025
c5a1b4b
Rollup merge of #136956 - jyn514:ignore-vendor, r=Noratrieb
workingjubilee Feb 14, 2025
a72aa95
Rollup merge of #136967 - DaniPopes:io-repeat-fill, r=joboet
workingjubilee Feb 14, 2025
dc8030e
Rollup merge of #136976 - jedbrown:jed/doc-boxed-deferred-init, r=tgr…
workingjubilee Feb 14, 2025
3080384
Rollup merge of #136981 - marcoieni:no-largedisk-loongarch, r=Kobzol
workingjubilee Feb 14, 2025
21bda53
Rollup merge of #136992 - ehuss:update-backtrace, r=workingjubilee
workingjubilee Feb 14, 2025
f431f11
Rollup merge of #136993 - dpaoliello:cleanllvm4, r=workingjubilee
workingjubilee Feb 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ no_llvm_build
/library/target
/src/bootstrap/target
/src/tools/x/target
# Created by `x vendor`
/vendor
# Created by default with `src/ci/docker/run.sh`
/obj/
# Created by nix dev shell / .envrc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ index 7165c3e48af..968552ad435 100644
--- a/library/alloc/Cargo.toml
+++ b/library/alloc/Cargo.toml
@@ -11,7 +11,7 @@ test = { path = "../test" }
edition = "2021"
bench = false

[dependencies]
core = { path = "../core" }
-compiler_builtins = { version = "=0.1.146", features = ['rustc-dep-of-std'] }
+compiler_builtins = { version = "=0.1.146", features = ['rustc-dep-of-std', 'no-f16-f128'] }

[dev-dependencies]
rand = { version = "0.8.5", default-features = false, features = ["alloc"] }
[features]
compiler-builtins-mem = ['compiler_builtins/mem']
--
2.34.1

2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ fn build_isa(sess: &Session) -> Arc<dyn TargetIsa + 'static> {
flags_builder.set("opt_level", "none").unwrap();
}
OptLevel::Less
| OptLevel::Default
| OptLevel::More
| OptLevel::Size
| OptLevel::SizeMin
| OptLevel::Aggressive => {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ fn to_gcc_opt_level(optlevel: Option<OptLevel>) -> OptimizationLevel {
Some(level) => match level {
OptLevel::No => OptimizationLevel::None,
OptLevel::Less => OptimizationLevel::Limited,
OptLevel::Default => OptimizationLevel::Standard,
OptLevel::More => OptimizationLevel::Standard,
OptLevel::Aggressive => OptimizationLevel::Aggressive,
OptLevel::Size | OptLevel::SizeMin => OptimizationLevel::Limited,
},
Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_codegen_llvm/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ codegen_llvm_lto_proc_macro = lto cannot be used for `proc-macro` crate type wit
codegen_llvm_mismatch_data_layout =
data-layout for target `{$rustc_target}`, `{$rustc_layout}`, differs from LLVM target's `{$llvm_target}` default layout, `{$llvm_layout}`

codegen_llvm_multiple_source_dicompileunit = multiple source DICompileUnits found
codegen_llvm_multiple_source_dicompileunit_with_llvm_err = multiple source DICompileUnits found: {$llvm_err}

codegen_llvm_parse_bitcode = failed to parse bitcode for LTO module
codegen_llvm_parse_bitcode_with_llvm_err = failed to parse bitcode for LTO module: {$llvm_err}

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_llvm/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ fn to_llvm_opt_settings(cfg: config::OptLevel) -> (llvm::CodeGenOptLevel, llvm::
match cfg {
No => (llvm::CodeGenOptLevel::None, llvm::CodeGenOptSizeNone),
Less => (llvm::CodeGenOptLevel::Less, llvm::CodeGenOptSizeNone),
Default => (llvm::CodeGenOptLevel::Default, llvm::CodeGenOptSizeNone),
More => (llvm::CodeGenOptLevel::Default, llvm::CodeGenOptSizeNone),
Aggressive => (llvm::CodeGenOptLevel::Aggressive, llvm::CodeGenOptSizeNone),
Size => (llvm::CodeGenOptLevel::Default, llvm::CodeGenOptSizeDefault),
SizeMin => (llvm::CodeGenOptLevel::Default, llvm::CodeGenOptSizeAggressive),
Expand All @@ -153,7 +153,7 @@ fn to_pass_builder_opt_level(cfg: config::OptLevel) -> llvm::PassBuilderOptLevel
match cfg {
No => llvm::PassBuilderOptLevel::O0,
Less => llvm::PassBuilderOptLevel::O1,
Default => llvm::PassBuilderOptLevel::O2,
More => llvm::PassBuilderOptLevel::O2,
Aggressive => llvm::PassBuilderOptLevel::O3,
Size => llvm::PassBuilderOptLevel::Os,
SizeMin => llvm::PassBuilderOptLevel::Oz,
Expand Down
5 changes: 0 additions & 5 deletions compiler/rustc_codegen_llvm/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ pub enum LlvmError<'a> {
LoadBitcode { name: CString },
#[diag(codegen_llvm_write_thinlto_key)]
WriteThinLtoKey { err: std::io::Error },
#[diag(codegen_llvm_multiple_source_dicompileunit)]
MultipleSourceDiCompileUnit,
#[diag(codegen_llvm_prepare_thin_lto_module)]
PrepareThinLtoModule,
#[diag(codegen_llvm_parse_bitcode)]
Expand All @@ -155,9 +153,6 @@ impl<G: EmissionGuarantee> Diagnostic<'_, G> for WithLlvmError<'_> {
PrepareThinLtoContext => fluent::codegen_llvm_prepare_thin_lto_context_with_llvm_err,
LoadBitcode { .. } => fluent::codegen_llvm_load_bitcode_with_llvm_err,
WriteThinLtoKey { .. } => fluent::codegen_llvm_write_thinlto_key_with_llvm_err,
MultipleSourceDiCompileUnit => {
fluent::codegen_llvm_multiple_source_dicompileunit_with_llvm_err
}
PrepareThinLtoModule => fluent::codegen_llvm_prepare_thin_lto_module_with_llvm_err,
ParseBitcode => fluent::codegen_llvm_parse_bitcode_with_llvm_err,
PrepareAutoDiff { .. } => fluent::codegen_llvm_prepare_autodiff_with_llvm_err,
Expand Down
16 changes: 8 additions & 8 deletions compiler/rustc_codegen_ssa/src/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ impl<'a> GccLinker<'a> {
let opt_level = match self.sess.opts.optimize {
config::OptLevel::No => "O0",
config::OptLevel::Less => "O1",
config::OptLevel::Default | config::OptLevel::Size | config::OptLevel::SizeMin => "O2",
config::OptLevel::More | config::OptLevel::Size | config::OptLevel::SizeMin => "O2",
config::OptLevel::Aggressive => "O3",
};

Expand Down Expand Up @@ -685,7 +685,7 @@ impl<'a> Linker for GccLinker<'a> {

// GNU-style linkers support optimization with -O. GNU ld doesn't
// need a numeric argument, but other linkers do.
if self.sess.opts.optimize == config::OptLevel::Default
if self.sess.opts.optimize == config::OptLevel::More
|| self.sess.opts.optimize == config::OptLevel::Aggressive
{
self.link_arg("-O1");
Expand Down Expand Up @@ -1213,7 +1213,7 @@ impl<'a> Linker for EmLinker<'a> {
self.cc_arg(match self.sess.opts.optimize {
OptLevel::No => "-O0",
OptLevel::Less => "-O1",
OptLevel::Default => "-O2",
OptLevel::More => "-O2",
OptLevel::Aggressive => "-O3",
OptLevel::Size => "-Os",
OptLevel::SizeMin => "-Oz",
Expand Down Expand Up @@ -1384,7 +1384,7 @@ impl<'a> Linker for WasmLd<'a> {
self.link_arg(match self.sess.opts.optimize {
OptLevel::No => "-O0",
OptLevel::Less => "-O1",
OptLevel::Default => "-O2",
OptLevel::More => "-O2",
OptLevel::Aggressive => "-O3",
// Currently LLD doesn't support `Os` and `Oz`, so pass through `O2`
// instead.
Expand Down Expand Up @@ -1451,7 +1451,7 @@ impl<'a> WasmLd<'a> {
let opt_level = match self.sess.opts.optimize {
config::OptLevel::No => "O0",
config::OptLevel::Less => "O1",
config::OptLevel::Default => "O2",
config::OptLevel::More => "O2",
config::OptLevel::Aggressive => "O3",
// wasm-ld only handles integer LTO opt levels. Use O2
config::OptLevel::Size | config::OptLevel::SizeMin => "O2",
Expand Down Expand Up @@ -1525,7 +1525,7 @@ impl<'a> Linker for L4Bender<'a> {
fn optimize(&mut self) {
// GNU-style linkers support optimization with -O. GNU ld doesn't
// need a numeric argument, but other linkers do.
if self.sess.opts.optimize == config::OptLevel::Default
if self.sess.opts.optimize == config::OptLevel::More
|| self.sess.opts.optimize == config::OptLevel::Aggressive
{
self.link_arg("-O1");
Expand Down Expand Up @@ -1929,7 +1929,7 @@ impl<'a> Linker for LlbcLinker<'a> {
match self.sess.opts.optimize {
OptLevel::No => "-O0",
OptLevel::Less => "-O1",
OptLevel::Default => "-O2",
OptLevel::More => "-O2",
OptLevel::Aggressive => "-O3",
OptLevel::Size => "-Os",
OptLevel::SizeMin => "-Oz",
Expand Down Expand Up @@ -2006,7 +2006,7 @@ impl<'a> Linker for BpfLinker<'a> {
self.link_arg(match self.sess.opts.optimize {
OptLevel::No => "-O0",
OptLevel::Less => "-O1",
OptLevel::Default => "-O2",
OptLevel::More => "-O2",
OptLevel::Aggressive => "-O3",
OptLevel::Size => "-Os",
OptLevel::SizeMin => "-Oz",
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_ssa/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ impl ModuleConfig {
// Copy what clang does by turning on loop vectorization at O2 and
// slp vectorization at O3.
vectorize_loop: !sess.opts.cg.no_vectorize_loops
&& (sess.opts.optimize == config::OptLevel::Default
&& (sess.opts.optimize == config::OptLevel::More
|| sess.opts.optimize == config::OptLevel::Aggressive),
vectorize_slp: !sess.opts.cg.no_vectorize_slp
&& sess.opts.optimize == config::OptLevel::Aggressive,
Expand All @@ -260,7 +260,7 @@ impl ModuleConfig {
MergeFunctions::Trampolines | MergeFunctions::Aliases => {
use config::OptLevel::*;
match sess.opts.optimize {
Aggressive | Default | SizeMin | Size => true,
Aggressive | More | SizeMin | Size => true,
Less | No => false,
}
}
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_ssa/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1054,12 +1054,12 @@ pub(crate) fn provide(providers: &mut Providers) {
config::OptLevel::No => return config::OptLevel::No,
// If globally optimise-speed is already specified, just use that level.
config::OptLevel::Less => return config::OptLevel::Less,
config::OptLevel::Default => return config::OptLevel::Default,
config::OptLevel::More => return config::OptLevel::More,
config::OptLevel::Aggressive => return config::OptLevel::Aggressive,
// If globally optimize-for-size has been requested, use -O2 instead (if optimize(size)
// are present).
config::OptLevel::Size => config::OptLevel::Default,
config::OptLevel::SizeMin => config::OptLevel::Default,
config::OptLevel::Size => config::OptLevel::More,
config::OptLevel::SizeMin => config::OptLevel::More,
};

let defids = tcx.collect_and_partition_mono_items(cratenum).all_mono_items;
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_mir_transform/src/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ impl<'tcx> crate::MirPass<'tcx> for Inline {
match sess.mir_opt_level() {
0 | 1 => false,
2 => {
(sess.opts.optimize == OptLevel::Default
|| sess.opts.optimize == OptLevel::Aggressive)
(sess.opts.optimize == OptLevel::More || sess.opts.optimize == OptLevel::Aggressive)
&& sess.opts.incremental == None
}
_ => true,
Expand Down
26 changes: 16 additions & 10 deletions compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,18 @@ pub enum CFProtection {

#[derive(Clone, Copy, Debug, PartialEq, Hash, HashStable_Generic)]
pub enum OptLevel {
No, // -O0
Less, // -O1
Default, // -O2
Aggressive, // -O3
Size, // -Os
SizeMin, // -Oz
/// `-Copt-level=0`
No,
/// `-Copt-level=1`
Less,
/// `-Copt-level=2`
More,
/// `-Copt-level=3` / `-O`
Aggressive,
/// `-Copt-level=s`
Size,
/// `-Copt-level=z`
SizeMin,
}

/// This is what the `LtoCli` values get mapped to after resolving defaults and
Expand Down Expand Up @@ -1253,7 +1259,7 @@ impl Options {
Some(setting) => setting,
None => match self.optimize {
OptLevel::No | OptLevel::Less | OptLevel::Size | OptLevel::SizeMin => true,
OptLevel::Default | OptLevel::Aggressive => false,
OptLevel::More | OptLevel::Aggressive => false,
},
}
}
Expand Down Expand Up @@ -1572,7 +1578,7 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
stack-protector-strategies|link-args|deployment-target]",
),
opt(Stable, FlagMulti, "g", "", "Equivalent to -C debuginfo=2", ""),
opt(Stable, FlagMulti, "O", "", "Equivalent to -C opt-level=2", ""),
opt(Stable, FlagMulti, "O", "", "Equivalent to -C opt-level=3", ""),
opt(Stable, Opt, "o", "", "Write output to <filename>", "FILENAME"),
opt(Stable, Opt, "", "out-dir", "Write output to compiler-chosen filename in <dir>", "DIR"),
opt(
Expand Down Expand Up @@ -2127,12 +2133,12 @@ fn parse_opt_level(
})
.max();
if max_o > max_c {
OptLevel::Default
OptLevel::Aggressive
} else {
match cg.opt_level.as_ref() {
"0" => OptLevel::No,
"1" => OptLevel::Less,
"2" => OptLevel::Default,
"2" => OptLevel::More,
"3" => OptLevel::Aggressive,
"s" => OptLevel::Size,
"z" => OptLevel::SizeMin,
Expand Down
Loading
Loading