[PATCH] D75689: [VectorCombine] fold extract-extract-op with different extraction indexes

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 5 09:52:06 PST 2020


lebedev.ri added a comment.

Taking a step back, we have

  ; 0. scalar
  %e0 = extractelement %x, C0
  %e1 = extractelement %y, C1
  %r = op %e0, %e1

Let's focus on `C0 != C1` problem, i see three general approaches there:

1. move either one lane to another lane
  1. move lane C0 to lane C1
  2. move lane C1 to lane C0
2. move both lanes into lane 0

In current solution, why do we decide to only entertain the idea of replacing the costlier extract?
Don't we want to check all three variants? (there's some overlap if one of C0,C1 is already lane 0)
What if the other extract is from lane 0? We'd then be able to use `TTI::SK_Broadcast`.



================
Comment at: llvm/lib/Transforms/Vectorize/VectorCombine.cpp:120
+
+    // If we are extracting from 2 different indexes, then 1 operand must be
+    // shuffled before performing the vector operation. The shuffle mask is
----------------
s/1/one/, else it's ambitious with 'first'


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75689/new/

https://reviews.llvm.org/D75689





More information about the llvm-commits mailing list