[PATCH] D78582: [InstCombine] substitute equivalent constant to reduce logic-of-icmps

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 21 13:33:28 PDT 2020


spatel created this revision.
spatel added reviewers: aqjune, lebedev.ri, nikic.
Herald added subscribers: hiraditya, mcrosier.

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

This is not a complete alternate to D78430 <https://reviews.llvm.org/D78430>, but it is a more general transform that gets us most of the expected simplifications and several other improvements. It's a smaller patch too, so hopefully, less chance to go wrong assuming the underlying logic is correct:
http://volta.cs.utah.edu:8080/z/5gxjjc

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


https://reviews.llvm.org/D78582

Files:
  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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78582.259082.patch
Type: text/x-patch
Size: 33322 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200421/fcb70be5/attachment.bin>


More information about the llvm-commits mailing list