[InstCombine] substitute equivalent constant to reduce logic-of-icmps
authorSanjay Patel <spatel@rotateright.com>
Thu, 23 Apr 2020 13:59:41 +0000 (09:59 -0400)
committerSanjay Patel <spatel@rotateright.com>
Thu, 23 Apr 2020 14:19:16 +0000 (10:19 -0400)
commit62da6ecea298739ad59c0563ce6d9493804ef1f0
treebef2deb05b3c590189dea5a374196617caf4a9ea
parent7003a1da37b2aae5b17460922efde9efde2c229d
[InstCombine] substitute equivalent constant to reduce logic-of-icmps

(X == C) && (Y Pred1 X) --> (X == C) && (Y Pred1 C)
(X != C) || (Y Pred1 X) --> (X != C) || (Y Pred1 C)

This cooperates/overlaps with D78430, but it is a more general transform
that gets us most of the expected simplifications and several other
improvements.
http://volta.cs.utah.edu:8080/z/5gxjjc

PR45618:
https://bugs.llvm.org/show_bug.cgi?id=45618

Differential Revision: https://reviews.llvm.org/D78582
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
llvm/test/Transforms/InstCombine/and-or-icmp-min-max.ll
llvm/test/Transforms/InstCombine/and-or-icmp-nullptr.ll
llvm/test/Transforms/InstCombine/and-or-icmps.ll