[all-commits] [llvm/llvm-project] 19b62b: [VectorCombine] try to form vector binop to elimin...

RotateRight via All-commits all-commits at lists.llvm.org
Thu Feb 13 14:31:57 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 19b62b79db1bb154b40e8baba9a28ab8aa935b6b
      https://github.com/llvm/llvm-project/commit/19b62b79db1bb154b40e8baba9a28ab8aa935b6b
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2020-02-13 (Thu, 13 Feb 2020)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/VectorCombine.cpp
    M llvm/test/Transforms/VectorCombine/X86/extract-binop.ll

  Log Message:
  -----------
  [VectorCombine] try to form vector binop to eliminate an extract element

binop (extelt X, C), (extelt Y, C) --> extelt (binop X, Y), C

This is a transform that has been considered for canonicalization (instcombine)
in the past because it reduces instruction count. But as shown in the x86 tests,
it's impossible to know if it's profitable without a cost model. There are many
potential target constraints to consider.

We have implemented similar transforms in the backend (DAGCombiner and
target-specific), but I don't think we have this exact fold there either (and if
we did it in SDAG, it wouldn't work across blocks).

Note: this patch was intended to handle the more general case where the extract
indexes do not match, but it got too big, so I scaled it back to this pattern
for now.

Differential Revision: https://reviews.llvm.org/D74495




More information about the All-commits mailing list