Skip value-label analysis if no value labels are present.
This commit is contained in:
@@ -804,6 +804,10 @@ impl<'func, I: VCodeInst> Lower<'func, I> {
|
||||
}
|
||||
|
||||
fn emit_value_label_markers_for_inst(&mut self, inst: Inst) {
|
||||
if self.f.dfg.values_labels.is_none() {
|
||||
return;
|
||||
}
|
||||
|
||||
debug!(
|
||||
"value labeling: srcloc {}: inst {}",
|
||||
self.srcloc(inst),
|
||||
@@ -815,6 +819,10 @@ impl<'func, I: VCodeInst> Lower<'func, I> {
|
||||
}
|
||||
|
||||
fn emit_value_label_markers_for_block_args(&mut self, block: Block) {
|
||||
if self.f.dfg.values_labels.is_none() {
|
||||
return;
|
||||
}
|
||||
|
||||
debug!("value labeling: block {}", block);
|
||||
for &arg in self.f.dfg.block_params(block) {
|
||||
self.emit_value_label_marks_for_value(arg);
|
||||
|
||||
@@ -118,6 +118,10 @@ pub struct VCode<I: VCodeInst> {
|
||||
|
||||
/// Constants.
|
||||
constants: VCodeConstants,
|
||||
|
||||
/// Are any debug value-labels present? If not, we can skip the
|
||||
/// post-emission analysis.
|
||||
has_value_labels: bool,
|
||||
}
|
||||
|
||||
/// A builder for a VCode function body. This builder is designed for the
|
||||
@@ -251,6 +255,9 @@ impl<I: VCodeInst> VCodeBuilder<I> {
|
||||
}
|
||||
}
|
||||
}
|
||||
if insn.defines_value_label().is_some() {
|
||||
self.vcode.has_value_labels = true;
|
||||
}
|
||||
self.vcode.insts.push(insn);
|
||||
self.vcode.srclocs.push(self.cur_srcloc);
|
||||
if is_safepoint {
|
||||
@@ -327,6 +334,7 @@ impl<I: VCodeInst> VCode<I> {
|
||||
generate_debug_info,
|
||||
insts_layout: RefCell::new((vec![], vec![], 0)),
|
||||
constants,
|
||||
has_value_labels: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -610,6 +618,10 @@ impl<I: VCodeInst> VCode<I> {
|
||||
|
||||
/// Generates value-label ranges.
|
||||
pub fn value_labels_ranges(&self) -> crate::result::CodegenResult<Option<ValueLabelsRanges>> {
|
||||
if !self.has_value_labels {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
let layout = &self.insts_layout.borrow();
|
||||
Ok(Some(debug::compute(
|
||||
&self.insts,
|
||||
|
||||
Reference in New Issue
Block a user