Skip to content

Commit db86e3c

Browse files
authored
[FuncSpec] Invalidate analysis by setting MadeChanges explicitly (#155833)
As reported in #154668 (comment), we missed invalidating analysis as we don't set the MadeChanges to true after removing dead functions. This patch makes it explicit to remove the dead functions marked by FuncSpec in SCCP and set MadeChanges correctly.
1 parent 2af8178 commit db86e3c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

llvm/lib/Transforms/IPO/SCCP.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,12 @@ static bool runIPSCCP(
170170
if (F.isDeclaration())
171171
continue;
172172
// Skip the dead functions marked by FunctionSpecializer, avoiding removing
173-
// blocks in dead functions.
174-
if (IsFuncSpecEnabled && Specializer.isDeadFunction(&F))
173+
// blocks in dead functions. Set MadeChanges if there is any dead function
174+
// that will be removed later.
175+
if (IsFuncSpecEnabled && Specializer.isDeadFunction(&F)) {
176+
MadeChanges = true;
175177
continue;
178+
}
176179

177180
SmallVector<BasicBlock *, 512> BlocksToErase;
178181

0 commit comments

Comments
 (0)