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

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 29 16:50:12 PDT 2016


eli.friedman added a comment.

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.

If the boolean comes from an icmp, it seems likely that you'll end up with `((X == Y) & C) | ((X != Y) & D)`.  I guess you can address that in a followup, if necessary.


================
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());
----------------
Please don't get rid of this comment... you don't have any others which actually describe the transform in full.


http://reviews.llvm.org/D21740





More information about the llvm-commits mailing list