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
Changes from 2 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: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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 => {
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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,
},
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_llvm/src/back/write.rs
Original file line number Diff line number Diff line change
@@ -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),
@@ -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,
16 changes: 8 additions & 8 deletions compiler/rustc_codegen_ssa/src/back/linker.rs
Original file line number Diff line number Diff line change
@@ -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",
};

@@ -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");
@@ -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",
@@ -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.
@@ -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",
@@ -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");
@@ -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",
@@ -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",
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_ssa/src/back/write.rs
Original file line number Diff line number Diff line change
@@ -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,
@@ -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,
}
}
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_ssa/src/base.rs
Original file line number Diff line number Diff line change
@@ -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;
3 changes: 1 addition & 2 deletions compiler/rustc_mir_transform/src/inline.rs
Original file line number Diff line number Diff line change
@@ -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,
26 changes: 16 additions & 10 deletions compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
@@ -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
@@ -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,
},
}
}
@@ -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(
@@ -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,
2 changes: 1 addition & 1 deletion src/doc/rustc/src/codegen-options/index.md
Original file line number Diff line number Diff line change
@@ -368,7 +368,7 @@ This flag controls the optimization level.
* `s`: optimize for binary size.
* `z`: optimize for binary size, but also turn off loop vectorization.

Note: The [`-O` flag][option-o-optimize] is an alias for `-C opt-level=2`.
Note: The [`-O` flag][option-o-optimize] is an alias for `-C opt-level=3`.

The default is `0`.

2 changes: 1 addition & 1 deletion src/doc/rustc/src/command-line-arguments.md
Original file line number Diff line number Diff line change
@@ -308,7 +308,7 @@ A synonym for [`-C debuginfo=2`](codegen-options/index.md#debuginfo).
<a id="option-o-optimize"></a>
## `-O`: optimize your code

A synonym for [`-C opt-level=2`](codegen-options/index.md#opt-level).
A synonym for [`-C opt-level=3`](codegen-options/index.md#opt-level).

<a id="option-o-output"></a>
## `-o`: filename of the output
2 changes: 1 addition & 1 deletion src/tools/run-make-support/src/external_deps/rustc.rs
Original file line number Diff line number Diff line change
@@ -84,7 +84,7 @@ impl Rustc {
self
}

/// Specify default optimization level `-O` (alias for `-C opt-level=2`).
/// Specify default optimization level `-O` (alias for `-C opt-level=3`).
pub fn opt(&mut self) -> &mut Self {
self.cmd.arg("-O");
self
2 changes: 1 addition & 1 deletion tests/run-make/rustc-help/help-v.stdout
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ Options:
--print [crate-name|file-names|sysroot|target-libdir|cfg|check-cfg|calling-conventions|target-list|target-cpus|target-features|relocation-models|code-models|tls-models|target-spec-json|all-target-specs-json|native-static-libs|stack-protector-strategies|link-args|deployment-target]
Compiler information to print on stdout
-g Equivalent to -C debuginfo=2
-O Equivalent to -C opt-level=2
-O Equivalent to -C opt-level=3
-o FILENAME Write output to <filename>
--out-dir DIR Write output to compiler-chosen filename in <dir>
--explain OPT Provide a detailed explanation of an error message
2 changes: 1 addition & 1 deletion tests/run-make/rustc-help/help.stdout
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ Options:
--print [crate-name|file-names|sysroot|target-libdir|cfg|check-cfg|calling-conventions|target-list|target-cpus|target-features|relocation-models|code-models|tls-models|target-spec-json|all-target-specs-json|native-static-libs|stack-protector-strategies|link-args|deployment-target]
Compiler information to print on stdout
-g Equivalent to -C debuginfo=2
-O Equivalent to -C opt-level=2
-O Equivalent to -C opt-level=3
-o FILENAME Write output to <filename>
--out-dir DIR Write output to compiler-chosen filename in <dir>
--explain OPT Provide a detailed explanation of an error message