[PATCH] D21899: [InstCombine] extend (select X, C1, C2 --> ext X) to vectors

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 6 10:11:58 PDT 2016


spatel added a comment.

In http://reviews.llvm.org/D21899#473188, @eli.friedman wrote:

> Re: your questions about canonicalization:
>
> Obviously, that doesn't really motivate the canonical representation either way.   That said, moving the xor in rather than out in general raises awkward questions about what to do in cases like "(zext i8 x to i32) ^ 257".  And changing the canonical representation probably involves some work to figure out what other transforms depend on the canonical representation of zext+xor.


Thanks for the answers! I don't think we need to worry about your ^257 example because we're only looking at i1 types for this transform.


================
Comment at: lib/Transforms/InstCombine/InstCombineSelect.cpp:971
@@ +970,3 @@
+
+    // select C, 1, 0 -> zext C to int
+    if (*FalseC == 0 && *TrueC == 1)
----------------
Yes - scalar i1 selects were all handled above, but vectors were not. That should be fixed with rL274465, so now we can assert that no i1 types make it down here.


http://reviews.llvm.org/D21899





More information about the llvm-commits mailing list