[PATCH] D105942: [SCEV] Fix unsound reasoning in howManyLessThans

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 13 15:39:25 PDT 2021


efriedma added a comment.

I think it makes sense to land this separately, if only to ensure we can bisect issues more accurately.



================
Comment at: llvm/test/Analysis/ScalarEvolution/trip-count-unknown-stride.ll:8
 ; CHECK-LABEL: Determining loop execution counts for: @foo1
-; CHECK: backedge-taken count is ((-1 + %n) /u %s)
+; CHECK: backedge-taken count is ((-1 + (%n smax %s)) /u %s)
 
----------------
We could actually handle this.

We have "%add = add nsw i32 %i.05, %s" in the IR, feeding into the backedge. We can use this to show "Start > Start - Stride": if it's false, we have poison feeding into the branch.  I don't think we use this sort of reasoning anywhere at the moment, though.

I don't think we need to block this patch for that, necessarily... but we should make sure we have a testcase that can't be rescued by this sort of reasoning.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105942/new/

https://reviews.llvm.org/D105942



More information about the llvm-commits mailing list