[llvm] [FunctionSpecializer] Keep the blocks in dead functions and remove the callsites of dead function properly. (PR #154668)

Alexandros Lamprineas via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 26 07:56:24 PDT 2025


================
@@ -167,7 +167,10 @@ static bool runIPSCCP(
   // constants if we have found them to be of constant values.
   bool MadeChanges = false;
   for (Function &F : M) {
-    if (F.isDeclaration())
+    // Skip the dead functions marked by FunctionSpecializer, avoiding removing
+    // blocks in dead functions.
+    if (F.isDeclaration() ||
----------------
labrinea wrote:

I would write this as a separate statement for clarity:

```
if (F.isDeclaration()
  continue;

// Skip the dead functions marked by FunctionSpecializer, avoiding removing
// blocks in dead functions.
if (IsFuncSpecEnabled && Specializer.isDeadFunction(&F))
  continue;
```  

https://github.com/llvm/llvm-project/pull/154668


More information about the llvm-commits mailing list