[InstSimplify] restrict icmp fold with 2 sdiv exact operands (PR32949)
authorSanjay Patel <spatel@rotateright.com>
Mon, 15 May 2017 19:16:49 +0000 (19:16 +0000)
committerSanjay Patel <spatel@rotateright.com>
Mon, 15 May 2017 19:16:49 +0000 (19:16 +0000)
commita23b141cd2120232ef0a7088fa9bc480773dcfe1
tree99a2de6eb5158674db6f8b04d7d2f9709c0c0cf2
parent12588d76db3fb291405b42ba49568b76c6602ba0
[InstSimplify] restrict icmp fold with 2 sdiv exact operands (PR32949)

These folds were introduced with https://reviews.llvm.org/rL127064 as part of solving:
https://bugs.llvm.org/show_bug.cgi?id=9343

As shown here:
http://rise4fun.com/Alive/C8
...however, the sdiv exact case needs a stronger predicate.

I opted for duplicated code instead of adding another fallthrough because I think that's
easier to read (and edit in case we need/want to restrict/loosen the predicates any more).

This should fix:
https://bugs.llvm.org/show_bug.cgi?id=32949
https://bugs.llvm.org/show_bug.cgi?id=32948

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

llvm-svn: 303104
llvm/lib/Analysis/InstructionSimplify.cpp
llvm/test/Transforms/InstSimplify/compare.ll