[llvm] [SCEV] Fix exit condition for recursive loop guard collection (PR #120442)

Julian Nagele via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 20 01:21:15 PST 2024


================
@@ -15767,7 +15768,7 @@ void ScalarEvolution::LoopGuards::collectFromBlock(
 
     // If we are recursively collecting guards stop after 2
     // predecessors to limit compile-time impact for now.
-    if (Depth > 0 && Terms.size() == 2)
+    if (Depth > 0 && ++NumCollectedConditions == 2)
----------------
juliannagele wrote:

Hm, I think it is actually counting the number of conditions, due to the early continue above, changed the comment instead (and pulled out the increment) :)

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


More information about the llvm-commits mailing list