[PATCH] D80885: [VectorCombine] scalarizeBinop - support an all-constant src vector operand

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 31 02:39:49 PDT 2020


RKSimon created this revision.
RKSimon added a reviewer: spatel.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

scalarizeBinop currently folds

  vec_bo((inselt VecC0, V0, Index), (inselt VecC1, V1, Index))
  ->
  inselt(vec_bo(VecC0, VecC1), scl_bo(V0,V1), Index)


This patch extends this to account for cases where one of the vec_bo operands is already all-constant and performs similar cost checks to determine if the scalar binop with a constant still makes sense:

  vec_bo((inselt VecC0, V0, Index), VecC1)
  ->
  inselt(vec_bo(VecC0, VecC1), scl_bo(V0,extractelt(V1,Index)), Index)

@spatel Have you any suggestions on specific test coverage you'd expect? So far I've just added the PR42174 test case (would you prefer this in pr42174.ll?) and haven't pre-committed the test case until I've got some initial feedback.

Fixes PR42174


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80885

Files:
  llvm/lib/Transforms/Vectorize/VectorCombine.cpp
  llvm/test/Transforms/VectorCombine/X86/insert-binop.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80885.267492.patch
Type: text/x-patch
Size: 6577 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200531/5df6efb0/attachment.bin>


More information about the llvm-commits mailing list