Skip to content

Commit

Permalink
[Assignment Tracking][NFC] Cache debug-info-assignment-tracking modul…
Browse files Browse the repository at this point in the history
…e flag

This reduces CTMark LTO-O3-g compile time by a geomean of 0.1%.

Reviewed By: jmorse

Differential Revision: https://reviews.llvm.org/D146985
  • Loading branch information
OCHyams committed Mar 29, 2023
1 parent 41c92c0 commit 06f28f2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 5 additions & 3 deletions llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Expand Up @@ -1051,6 +1051,8 @@ void SelectionDAGBuilder::init(GCFunctionInfo *gfi, AliasAnalysis *aa,
Context = DAG.getContext();
LPadToCallSiteMap.clear();
SL->init(DAG.getTargetLoweringInfo(), TM, DAG.getDataLayout());
AssignmentTrackingEnabled = isAssignmentTrackingEnabled(
*DAG.getMachineFunction().getFunction().getParent());
}

void SelectionDAGBuilder::clear() {
Expand Down Expand Up @@ -6113,7 +6115,7 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
}
case Intrinsic::dbg_declare: {
// Debug intrinsics are handled separately in assignment tracking mode.
if (isAssignmentTrackingEnabled(*I.getFunction()->getParent()))
if (AssignmentTrackingEnabled)
return;
// Assume dbg.declare can not currently use DIArgList, i.e.
// it is non-variadic.
Expand Down Expand Up @@ -6208,13 +6210,13 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
}
case Intrinsic::dbg_assign: {
// Debug intrinsics are handled seperately in assignment tracking mode.
assert(isAssignmentTrackingEnabled(*I.getFunction()->getParent()) &&
assert(AssignmentTrackingEnabled &&
"expected assignment tracking to be enabled");
return;
}
case Intrinsic::dbg_value: {
// Debug intrinsics are handled seperately in assignment tracking mode.
if (isAssignmentTrackingEnabled(*I.getFunction()->getParent()))
if (AssignmentTrackingEnabled)
return;
const DbgValueInst &DI = cast<DbgValueInst>(I);
assert(DI.getVariable() && "Missing variable");
Expand Down
4 changes: 4 additions & 0 deletions llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
Expand Up @@ -175,6 +175,10 @@ class SelectionDAGBuilder {
/// We defer handling these until we do see it.
MapVector<const Value*, DanglingDebugInfoVector> DanglingDebugInfoMap;

/// Cache the module flag for whether we should use debug-info assignment
/// tracking.
bool AssignmentTrackingEnabled = false;

public:
/// Loads are not emitted to the program immediately. We bunch them up and
/// then emit token factor nodes when possible. This allows us to get simple
Expand Down

0 comments on commit 06f28f2

Please sign in to comment.