[SimplifyIndvar] Replace the srem used by IV if we can prove both of its operands...
authorHongbin Zheng <etherzhhb@gmail.com>
Mon, 25 Sep 2017 17:39:40 +0000 (17:39 +0000)
committerHongbin Zheng <etherzhhb@gmail.com>
Mon, 25 Sep 2017 17:39:40 +0000 (17:39 +0000)
commitf0093e45c4fb5a765ddf94367ddd675f3efb6bc3
treeb3f22ef8a7ccfbec412b150d018f9c0a327e3042
parent310389691408b89a89c197ad7cdc98494b22e2b4
[SimplifyIndvar] Replace the srem used by IV if we can prove both of its operands are non-negative

Since now SCEV can handle 'urem', an 'urem' is a better canonical form than an 'srem' because it has well-defined behavior

This is a follow up of D34598

Differential Revision: https://reviews.llvm.org/D38072

llvm-svn: 314125
llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
llvm/test/Transforms/IndVarSimplify/eliminate-rem.ll
llvm/test/Transforms/IndVarSimplify/replace-srem-by-urem.ll [new file with mode: 0644]