[PATCH] D34184: [InstCombine] Teach foldSelectICmpAndOr to recognize (select (icmp slt (trunc (X)), 0), Y, (or Y, C2))

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 13 16:42:34 PDT 2017


craig.topper created this revision.

InstCombine likes to turn (icmp eq (and X, C1), 0) into (icmp slt (trunc (X)), 0) sometimes. This breaks foldSelectICmpAndOr's ability to recognize (select (icmp eq (and X, C1), 0), Y, (or Y, C2))->(or (shl (and X, C1), C3), y).

This patch tries to recover this. I had to flip around some of the early out checks so that I could create a new And instruction during the compare processing without it possibly never getting used.


https://reviews.llvm.org/D34184

Files:
  lib/Transforms/InstCombine/InstCombineSelect.cpp
  test/Transforms/InstCombine/select-with-bitwise-ops.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34184.102451.patch
Type: text/x-patch
Size: 4399 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170613/a83f7566/attachment.bin>


More information about the llvm-commits mailing list