Skip to content

Commit b80045a

Browse files
Fix bug in dropped variable statistics for SIL.
When checking for false positives, we want to make sure that if a debug_value is dropped, we also find a real instruction that shares the same scope as the debug_value or has a scope that is a child of the scope of the debug_value, and has an inlinedAt equal to the inlinedAt of the debug_value or it's inlinedAt chain contains the inlinedAt of the debug_value. However, this instruction shouldn't be another debug_value. The check was supossed to check if(!I.isDebugInstruction()) but it checked if(I.isDebugInstruction()) This patch fixes that bug.
1 parent 0997a7e commit b80045a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/SILOptimizer/Utils/OptimizerStatsUtils.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ int computeLostVariables(SILFunction *F, FunctionStat &Old, FunctionStat &New) {
782782
auto &DbgValScope = std::get<0>(Var);
783783
for (auto &BB : *F) {
784784
for (auto &I : BB) {
785-
if (I.isDebugInstruction()) {
785+
if (!I.isDebugInstruction()) {
786786
auto DbgLoc = I.getDebugLocation();
787787
auto Scope = DbgLoc.getScope();
788788
// If the Scope is a child of, or equal to the DbgValScope and is

0 commit comments

Comments
 (0)