[PATCH] D103834: [SCEV] Properly guard reasoning about infinite loops being UB on mustprogress

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 10 10:08:55 PDT 2021


nikic added a comment.

In D103834#2810908 <https://reviews.llvm.org/D103834#2810908>, @bjope wrote:

> Sorry, I used wrong example in the link. I've changed it to something where I do "i += n" instead of "i += n/2".
>
> Is perhaps the problem that "i += n" might overflow (UB) and thereby we can't guarantee "must progress"?

For the updated example it should be technically fine, but SCEV is not strong enough to figure out that `n != 0` at that point. Possibly performing an additional `isLoopEntryGuardedByCond()` check for `!= 0` would help.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103834



More information about the llvm-commits mailing list