[llvm] [SLSR] Skipping rewriting based on liveness (PR #218470)

Igor Wodiany via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 02:54:36 PDT 2026


================
@@ -1411,6 +1423,380 @@ bool StraightLineStrengthReduceLegacyPass::runOnFunction(Function &F) {
   return StraightLineStrengthReduce(DL, DT, SE, TTI).runOnFunction(F);
 }
 
+namespace {
+
+class RewriteFilter {
+  // Recondiser rewriting a basic block holding many distinct SLSR bases.
+
+  // Each basis contributes one extended live range no matter how many
+  // candidates are rewritten against it in a basic block.
+  // If the number of bases is above this threshold do a check if the
+  // liveness of the block has increase a lot by SLSR.
+  static constexpr unsigned MinDistinctBasisesToFilter = 16;
----------------
IgWod wrote:

Thanks for the detailed explanation. I have no preference regarding using cl::opt, I guess we can leave it as it now and change it if there is a use case for that.

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


More information about the llvm-commits mailing list