[ScalarEvolution] createSCEV(): recognize `udiv`/`urem` disguised as an `sdiv`/`srem`
authorRoman Lebedev <lebedev.ri@gmail.com>
Thu, 2 Jul 2020 09:44:48 +0000 (12:44 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Thu, 2 Jul 2020 10:22:12 +0000 (13:22 +0300)
commit2c16100e6f72075564ea1f67fa5a82c269dafcd3
tree9de594137f255a42c4bee58424d71651e90a44d3
parent68498ce8af375a97a87738676fc2917c0c9659d6
[ScalarEvolution] createSCEV(): recognize `udiv`/`urem` disguised as an `sdiv`/`srem`

Summary:
While InstCombine trivially converts that `srem` into a `urem`,
it might happen later than wanted, in particular i'd like
for that to happen on  https://godbolt.org/z/bwuEmJ test case
early in pipeline, before first instcombine run, just before `-mem2reg`.

SCEV should recognize this case natively.

Reviewers: mkazantsev, efriedma, nikic, reames

Reviewed By: efriedma

Subscribers: clementval, hiraditya, javed.absar, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D82721
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/test/Analysis/ScalarEvolution/sdiv.ll
llvm/test/Analysis/ScalarEvolution/srem.ll