forked from OSchip/llvm-project
[DwarfDebug] Improve validThroughout performance (4/4)
Almost NFC (see end). The backwards scan in validThroughout significantly contributed to compile time for a pathological case, causing the 'X86 Assembly Printer' pass to account for roughly 70% of the run time. This patch guards the loop against running unnecessarily, bringing the pass contribution down to 4%. Almost NFC: There is a hack in validThroughout which promotes single constant value DBG_VALUEs in the prologue to be live throughout the function. We're more likely to hit this code path with this patch applied. Similarly to the parent patches there is a small coverage change reported in the order of 10s of bytes. Reviewed By: aprantl Differential Revision: https://reviews.llvm.org/D86153
This commit is contained in:
parent
3c491881d2
commit
57d8acac64
|
@ -1531,10 +1531,12 @@ static bool validThroughout(LexicalScopes &LScopes,
|
||||||
if (LSRange.size() == 0)
|
if (LSRange.size() == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
// Determine if the DBG_VALUE is valid at the beginning of its lexical block.
|
|
||||||
const MachineInstr *LScopeBegin = LSRange.front().first;
|
const MachineInstr *LScopeBegin = LSRange.front().first;
|
||||||
// Early exit if the lexical scope begins outside of the current block.
|
// If the scope starts before the DBG_VALUE then we may have a negative
|
||||||
|
// result. Otherwise the location is live coming into the scope and we
|
||||||
|
// can skip the following checks.
|
||||||
|
if (!Ordering.isBefore(DbgValue, LScopeBegin)) {
|
||||||
|
// Exit if the lexical scope begins outside of the current block.
|
||||||
if (LScopeBegin->getParent() != MBB)
|
if (LScopeBegin->getParent() != MBB)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1553,6 +1555,7 @@ static bool validThroughout(LexicalScopes &LScopes,
|
||||||
if (!PredScope || LScope->dominates(PredScope))
|
if (!PredScope || LScope->dominates(PredScope))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If the range of the DBG_VALUE is open-ended, report success.
|
// If the range of the DBG_VALUE is open-ended, report success.
|
||||||
if (!RangeEnd)
|
if (!RangeEnd)
|
||||||
|
|
|
@ -19,8 +19,7 @@
|
||||||
; CHECK: DW_TAG_inlined_subroutine
|
; CHECK: DW_TAG_inlined_subroutine
|
||||||
; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "bar"
|
; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "bar"
|
||||||
; CHECK: DW_TAG_formal_parameter
|
; CHECK: DW_TAG_formal_parameter
|
||||||
; CHECK-NEXT: DW_AT_location [DW_FORM_data4] (
|
; CHECK-NEXT: DW_AT_const_value [DW_FORM_sdata] (0)
|
||||||
; CHECK-NEXT: [{{.*}}, {{.*}}): DW_OP_consts +0)
|
|
||||||
; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "a"
|
; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "a"
|
||||||
|
|
||||||
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
||||||
|
|
Loading…
Reference in New Issue