Skip to content

Commit e433fc3

Browse files
[NFC] Add error checking for InlinedAts.
The DroppedVariableStats::calculateDroppedStatsAndPrint should check if it's InlinedAts stack contains the the function name that is being accessed to make sure that a pass did not create a new function declaration which may then lead to a crash. For example, in hot-cold splitting, the Module before the pass will not contain the newly created cold function and can cause a crash when trying to access the InlinedAts stack with the function name of the newly created cold function.
1 parent 9de581b commit e433fc3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

llvm/include/llvm/Passes/DroppedVariableStats.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ class DroppedVariableStats {
9696
DenseSet<VarID> &DebugVariablesBeforeSet =
9797
DbgVariables.DebugVariablesBefore;
9898
DenseSet<VarID> &DebugVariablesAfterSet = DbgVariables.DebugVariablesAfter;
99+
if (InlinedAts.back().find(FuncName) == InlinedAts.back().end())
100+
return;
99101
DenseMap<VarID, DILocation *> &InlinedAtsMap = InlinedAts.back()[FuncName];
100102
// Find an Instruction that shares the same scope as the dropped #dbg_value
101103
// or has a scope that is the child of the scope of the #dbg_value, and has

0 commit comments

Comments
 (0)