[llvm] db86e3c - [FuncSpec] Invalidate analysis by setting MadeChanges explicitly (#155833)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 28 10:12:38 PDT 2025
Author: XChy
Date: 2025-08-28T17:12:34Z
New Revision: db86e3c1c7e01a95671811f64a3b28ec8018402e
URL: https://github.com/llvm/llvm-project/commit/db86e3c1c7e01a95671811f64a3b28ec8018402e
DIFF: https://github.com/llvm/llvm-project/commit/db86e3c1c7e01a95671811f64a3b28ec8018402e.diff
LOG: [FuncSpec] Invalidate analysis by setting MadeChanges explicitly (#155833)
As reported in
https://github.com/llvm/llvm-project/issues/154668#issuecomment-3233294078,
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.
Added:
Modified:
llvm/lib/Transforms/IPO/SCCP.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/SCCP.cpp b/llvm/lib/Transforms/IPO/SCCP.cpp
index f4961faf7ad18..2ecadd529170f 100644
--- a/llvm/lib/Transforms/IPO/SCCP.cpp
+++ b/llvm/lib/Transforms/IPO/SCCP.cpp
@@ -170,9 +170,12 @@ static bool runIPSCCP(
if (F.isDeclaration())
continue;
// Skip the dead functions marked by FunctionSpecializer, avoiding removing
- // blocks in dead functions.
- if (IsFuncSpecEnabled && Specializer.isDeadFunction(&F))
+ // blocks in dead functions. Set MadeChanges if there is any dead function
+ // that will be removed later.
+ if (IsFuncSpecEnabled && Specializer.isDeadFunction(&F)) {
+ MadeChanges = true;
continue;
+ }
SmallVector<BasicBlock *, 512> BlocksToErase;
More information about the llvm-commits
mailing list