[PATCH] D116688: [SLP]Excluded external uses from the reprdering estimation.

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 6 12:51:55 PST 2022


ABataev added a comment.

In D116688#3225955 <https://reviews.llvm.org/D116688#3225955>, @vporpo wrote:

> I agree with your second point, it is too pessimistic and should be fixed. 
> But I don't fully follow your first point. What do you mean that it will affect the cost in all lanes?
>
> Here is an example where the external uses cost can help:
>
>   %1 = load A[0]
>   %2 = load A[1] // %2 has external use
>   %3 = load B[0]
>   %4 = load A[1]
>   %Ln1 = add %1, %3
>   %Ln2 = add %2, %4
>   ...
>   ... = %2 // External use of %2
>
> While doing the operand reordering we can choose to vectorize either {%1, %2} or {%1, %4}. 
> Both have the same opcodes etc. so the rest of the cost calculation will give them the exact same score.
> But wouldn't we prefer to vectorize {%1, %4} rather than {%1, %2} to avoid the extract instruction? 
> How would we do this without taking into account the cost of the external uses?

These 2 loads from A[1] will be combined by instcombine before SLP.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116688



More information about the llvm-commits mailing list