[PATCH] D26641: [InstCombine] change bitwise logic type to eliminate bitcasts

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 21 16:47:23 PST 2016


efriedma added a comment.

I'm a little skeptical this is a good idea in all cases... it would be terrible to transform a vector xor into an i128 xor (and therefore force the operation into integer registers) just because SROA happened to produce an i128, or some calling convention has weird requirements.  The transform looks good for your testcase in PR27925 in particular because "xor <2 x i64>" and "xor <4 x i32>" lower to the same instruction on x86.



================
Comment at: lib/Transforms/InstCombine/InstCombineCasts.cpp:1796
+  if (match(BO->getOperand(0), m_OneUse(m_BitCast(m_Value(X)))) &&
+      X->getType() == DestTy && !isa<Constant>(X)) {
+    // bitcast(logic(bitcast(X), Y)) --> logic'(X, bitcast(Y))
----------------
Don't you need some sort of check that DestTy is an integer type?


https://reviews.llvm.org/D26641





More information about the llvm-commits mailing list