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

Alexis Engelke via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 3 06:05:38 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,
----------------
aengelke wrote:

> I'd rather completely remove EliminateUnreachableBlocks.

Agreed. We shouldn't have two functions doing similar things with confusing similar names.

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


More information about the llvm-commits mailing list