[llvm] [SimplifyCFG] Avoid scanning functions multiple times in `removeUnreachableBlocks` (PR #213416)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 3 06:44:49 PDT 2026


================
@@ -287,12 +287,15 @@ static bool simplifyFunctionCFGImpl(Function &F, const TargetTransformInfo &TTI,
   // iterate between the two optimizations.  We structure the code like this to
   // avoid rerunning iterativelySimplifyCFG if the second pass of
   // removeUnreachableBlocks doesn't do anything.
-  if (!removeUnreachableBlocks(F, DT ? &DTU : nullptr))
+  // Avoid scanning instructions to reduce compile-time.
+  if (!removeUnreachableBlocks(F, DT ? &DTU : nullptr, /*MSSAU=*/nullptr,
----------------
antoniofrighetto wrote:

> I'd rather completely remove `EliminateUnreachableBlocks`.

This was not clear to me before. Sounds great if the plan is to eventually remove EliminateUnreachableBlocks().

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


More information about the llvm-commits mailing list