Some optimizations
* Only format global _comments when debug_assertions are enabled * Only call build_value_labels_ranges in base.rs when debug_assertions are enabled Benchmark #1: CHANNEL='pre' ../cargo.sh build Time (mean ± σ): 17.657 s ± 1.050 s [User: 31.871 s, System: 3.014 s] Range (min … max): 16.907 s … 20.394 s 10 runs Benchmark #2: ../cargo.sh build Time (mean ± σ): 16.640 s ± 0.255 s [User: 30.238 s, System: 2.965 s] Range (min … max): 16.413 s … 17.186 s 10 runs Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet PC without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options. Summary '../cargo.sh build' ran 1.06 ± 0.07 times faster than 'CHANNEL='pre' ../cargo.sh build'
This commit is contained in:
parent
c84ff8504a
commit
b86eb2e8ba
26
src/base.rs
26
src/base.rs
@ -74,20 +74,22 @@ pub fn trans_fn<'clif, 'tcx, B: Backend + 'static>(
|
||||
context.func = func;
|
||||
cx.module.define_function(func_id, context).unwrap();
|
||||
|
||||
let value_ranges = context
|
||||
.build_value_labels_ranges(cx.module.isa())
|
||||
.expect("value location ranges");
|
||||
|
||||
// Write optimized function to file for debugging
|
||||
#[cfg(debug_assertions)]
|
||||
crate::pretty_clif::write_clif_file(
|
||||
cx.tcx,
|
||||
"opt",
|
||||
instance,
|
||||
&context.func,
|
||||
&clif_comments,
|
||||
Some(&value_ranges),
|
||||
);
|
||||
{
|
||||
let value_ranges = context
|
||||
.build_value_labels_ranges(cx.module.isa())
|
||||
.expect("value location ranges");
|
||||
|
||||
crate::pretty_clif::write_clif_file(
|
||||
cx.tcx,
|
||||
"opt",
|
||||
instance,
|
||||
&context.func,
|
||||
&clif_comments,
|
||||
Some(&value_ranges),
|
||||
);
|
||||
}
|
||||
|
||||
// Define debuginfo for function
|
||||
let isa = cx.module.isa();
|
||||
|
@ -74,8 +74,8 @@ pub struct CommentWriter {
|
||||
|
||||
impl CommentWriter {
|
||||
pub fn new<'tcx>(tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) -> Self {
|
||||
CommentWriter {
|
||||
global_comments: vec![
|
||||
let mut global_comments = if cfg!(debug_assertions) {
|
||||
vec![
|
||||
format!("symbol {}", tcx.symbol_name(instance).name.as_str()),
|
||||
format!("instance {:?}", instance),
|
||||
format!(
|
||||
@ -86,7 +86,13 @@ impl CommentWriter {
|
||||
)
|
||||
),
|
||||
String::new(),
|
||||
],
|
||||
]
|
||||
} else {
|
||||
vec![]
|
||||
};
|
||||
|
||||
CommentWriter {
|
||||
global_comments,
|
||||
entity_comments: HashMap::new(),
|
||||
inst_comments: HashMap::new(),
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user