[PATCH] D21740: [InstCombine] extend matchSelectFromAndOr() to work with i1 scalar types

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 29 17:35:00 PDT 2016


spatel added a comment.

In http://reviews.llvm.org/D21740#470799, @eli.friedman wrote:

> Would it make sense to add "m_SExtOrBool" or something like that, which matches a value which matches either a sext or a value of boolean type?  That seems like a cleaner way to generalize the transform.


Not sure if that matcher would be generally useful. For the non-splat vectors scenarios that I'm seeing, I may need to add something to ValueTracking like 'isAllOnesOrAllZerosElts()' [return true if a scalar value is -1 or 0 or if all elements of a vector are -1 or 0 (but not necessarily that all elements are the same). So that would be an even more general way to catch these. I'd prefer to keep this patch simpler and then see what's needed for the 'TODO' comment.


================
Comment at: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1654
@@ -1653,3 +1669,1 @@
-    // The bitcasts will either all exist or all not exist. The builder will
-    // not create unnecessary casts if the types already match.
     Value *BitcastC = Builder.CreateBitCast(C, A->getType());
----------------
eli.friedman wrote:
> Please don't get rid of this comment... you don't have any others which actually describe the transform in full.
Oops - that was an unintended delete. Let me restore it.


http://reviews.llvm.org/D21740





More information about the llvm-commits mailing list