[PATCH] PR20234 - [SLP Vectorizer] Canonicalize operands of commutitive binary operands.

Chad Rosier mcrosier at codeaurora.org
Fri Jul 25 18:16:01 PDT 2014


>>! In D4680#5, @nadav wrote:
> Chad, 
> 
> In this patch you are changing the instruction V regardless if vectorization succeeds or not. Would it be possible to only change the VL vector without modifying the binary operator V?  
> 
> Thanks,
> Nadav

Nadav,
That would be perfectly fine.  In fact, it's the right thing to do as we don't want to undo the canonicalization performed by the reassociation pass.

 Chad

================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:2425
@@ +2424,3 @@
+    if (IndexA > IndexB) {
+      V->setOperand(0, B);
+      V->setOperand(1, A);
----------------
We don't need to actually modify the instruction for this to work.

http://reviews.llvm.org/D4680






More information about the llvm-commits mailing list