[PATCH] [Reassociate] Add initial support for vector instructions.

Robert Lougher rob.lougher at gmail.com
Mon Feb 23 10:19:25 PST 2015


Thanks for the review Sanjay.


================
Comment at: lib/Transforms/Scalar/Reassociate.cpp:2091
@@ -2092,3 +2090,3 @@
 
-  // Don't optimize vector instructions.
-  if (I->getType()->isVectorTy())
+  // Don't optimize vector Xor instructions.
+  if (I->getType()->isVectorTy() && I->getOpcode() == Instruction::Xor)
----------------
spatel wrote:
> Can you add a bit to the comment to explain?
> Is this because we want to distinguish zero'ing idioms? 
OK, I'll add a comment here.  The only reason is that OptimizeXor (and helpers) hasn't been vectorized yet.  This will be done in a later patch.


================
Comment at: test/Transforms/Reassociate/fast-ReassociateVector.ll:4
@@ +3,3 @@
+; Check that a*c+b*c is turned into (a+b)*c
+define <4 x float> @test1(<4 x float> %a, <4 x float> %b, <4 x float> %c) {
+; CHECK-LABEL: @test1
----------------
spatel wrote:
> I assume all of the floating point transforms apply identically to doubles as well as floats. Can you change some of these tests to use doubles so we have some coverage for those?
OK. I'll update the patch.

http://reviews.llvm.org/D7566

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list