[PATCH] D122835: [SCEV] Fix a bug that caused an invalid assertion.

YangguangLi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 31 10:20:51 PDT 2022


Yangguang created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
Yangguang requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The assertion is to check we always get backedge taken count
(`BECount`) of zero when the exit condition is in select form (`isa<
BinaryOperation>(ExitCond)`) and the exit limit for the first operand
is zero (`EL0.ExactNotTaken->isZero()`).  However the assertion is
checking that the exit condition is NOT in select form.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122835

Files:
  llvm/lib/Analysis/ScalarEvolution.cpp


Index: llvm/lib/Analysis/ScalarEvolution.cpp
===================================================================
--- llvm/lib/Analysis/ScalarEvolution.cpp
+++ llvm/lib/Analysis/ScalarEvolution.cpp
@@ -8439,7 +8439,7 @@
 
       // If EL0.ExactNotTaken was zero and ExitCond was a short-circuit form,
       // it should have been simplified to zero (see the condition (3) above)
-      assert(!isa<BinaryOperator>(ExitCond) || !EL0.ExactNotTaken->isZero() ||
+      assert(isa<BinaryOperator>(ExitCond) || !EL0.ExactNotTaken->isZero() ||
              BECount->isZero());
     }
     if (EL0.MaxNotTaken == getCouldNotCompute())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122835.419509.patch
Type: text/x-patch
Size: 629 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220331/c200cc54/attachment.bin>


More information about the llvm-commits mailing list