[PATCH] D36498: [InstCombine] Teach foldSelectICmpAnd to recognize a (icmp slt trunc X, 0) and (icmp sgt trunc X, -1) as equivalent to an and with the sign bit of the truncated type

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 15 15:08:47 PDT 2017


craig.topper added a comment.

Yeah we probably need to check fpr one use, but I'd like to do that separately from this.

I want to reimplement foldSelectICmpAndOr by calling foldSelectICmpAnd from foldSelectIntoOp if the immediate in foldSelectIntoOp is a power of 2. This will allow the transform in foldSelectICmpAndOr to support Xor as well because there was no reason to restrict it to just Or. And of course it will remove some very similar duplicated code. To do that I'll need to revisit all the one use enhancements that were already added to foldSelectICmpAndOr anyway.


https://reviews.llvm.org/D36498





More information about the llvm-commits mailing list