[PATCH] D36505: [InstCombine] Make (X|C1)^C2 -> X^(C1^C2) iff X&~C1 == 0 work for splat vectors

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 10 07:23:27 PDT 2017

spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.


Comment at: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2393-2394
+      // (X|C1)^C2 -> X^(C1^C2) iff X&~C1 == 0
+      if (match(Op0, m_Or(m_Value(V), m_APInt(C))) &&
+          MaskedValueIsZero(V, *C, 0, &I)) {
Nit / potential clean-up: I like to make the variable names match the comment names for easier reading when possible, so I'd pick either 'X' or 'V' and stick with it throughout this block.

Comment at: test/Transforms/InstCombine/select-with-bitwise-ops.ll:271
 define <2 x i32> @test65vec(<2 x i64> %x) {
 ; CHECK-LABEL: @test65vec(
Are we just changing the mask constant in these 3 tests to prove that MaskedValueIsZero() is working as expected? Might be more interesting to use a shift or zext to clear some bits instead?


More information about the llvm-commits mailing list