llvm-project/llvm/lib/Transforms/Vectorize
Sanjay Patel ce97ce3a5d [VectorCombine] try to form a better extractelement
Extracting to the same index that we are going to insert back into
allows forming select ("blend") shuffles and enables further transforms.

Admittedly, this is a quick-fix for a more general problem that I'm
hoping to solve by adding transforms for patterns that start with an
insertelement.

But this might resolve some regressions known to be caused by the
extract-extract transform (although I have not gotten more details on
those yet).

In the motivating case from PR34724:
https://bugs.llvm.org/show_bug.cgi?id=34724

The combination of subsequent instcombine and codegen transforms gets us this improvement:

  vmovshdup	%xmm0, %xmm2    ## xmm2 = xmm0[1,1,3,3]
  vhaddps	%xmm1, %xmm1, %xmm4
  vmovshdup	%xmm1, %xmm3    ## xmm3 = xmm1[1,1,3,3]
  vaddps	%xmm0, %xmm2, %xmm0
  vaddps	%xmm1, %xmm3, %xmm1
  vshufps	$200, %xmm4, %xmm0, %xmm0 ## xmm0 = xmm0[0,2],xmm4[0,3]
  vinsertps	$177, %xmm1, %xmm0, %xmm0 ## xmm0 = zero,xmm0[1,2],xmm1[2]

  -->

  vmovshdup	%xmm0, %xmm2    ## xmm2 = xmm0[1,1,3,3]
  vhaddps	%xmm1, %xmm1, %xmm1
  vaddps	%xmm0, %xmm2, %xmm0
  vshufps	$200, %xmm1, %xmm0, %xmm0 ## xmm0 = xmm0[0,2],xmm1[0,3]

Differential Revision: https://reviews.llvm.org/D76623
2020-04-03 13:55:13 -04:00
..
CMakeLists.txt [VectorCombine] new IR transform pass for partial vector ops 2020-02-09 10:04:41 -05:00
LLVMBuild.txt
LoadStoreVectorizer.cpp [Alignment][NFC] Remove unused private functions 2020-04-03 09:16:20 +00:00
LoopVectorizationLegality.cpp [LoopVectorizer] Change types of lists from pointers to references. NFC 2020-03-02 15:04:41 +00:00
LoopVectorizationPlanner.h [LV] Do not try to sink dead instructions. 2020-01-28 08:28:03 -08:00
LoopVectorize.cpp Remove "mask" operand from shufflevector. 2020-03-31 13:08:59 -07:00
SLPVectorizer.cpp [SLP] Avoid repeated visitation in getVectorElementSize(); NFC 2020-03-22 14:34:29 +01:00
VPRecipeBuilder.h [VPlan] Use one VPWidenRecipe per original IR instruction. (NFC). 2020-03-29 13:47:28 +01:00
VPlan.cpp [VPlan] Use one VPWidenRecipe per original IR instruction. (NFC). 2020-03-29 13:47:28 +01:00
VPlan.h [VPlan] Use one VPWidenRecipe per original IR instruction. (NFC). 2020-03-29 13:47:28 +01:00
VPlanDominatorTree.h
VPlanHCFGBuilder.cpp Hide two unused debugging methods, NFCI. 2019-03-01 17:15:21 +00:00
VPlanHCFGBuilder.h
VPlanLoopInfo.h
VPlanPredicator.cpp Update files that were mistakenly added with the old file header to the 2019-02-11 08:07:38 +00:00
VPlanPredicator.h Update files that were mistakenly added with the old file header to the 2019-02-11 08:07:38 +00:00
VPlanSLP.cpp [VPlanSLP] Don't dereference a cast_or_null<VPInstruction> result. NFCI. 2019-09-16 11:22:44 +00:00
VPlanTransforms.cpp [VPlan] Use one VPWidenRecipe per original IR instruction. (NFC). 2020-03-29 13:47:28 +01:00
VPlanTransforms.h [LoopVectorizer] Change types of lists from pointers to references. NFC 2020-03-02 15:04:41 +00:00
VPlanValue.h [VPlan] Use underlying value for printing, if available. 2020-03-18 17:46:57 +00:00
VPlanVerifier.cpp Add missing includes needed to prune LLVMContext.h include, NFC 2019-11-14 15:23:15 -08:00
VPlanVerifier.h
VectorCombine.cpp [VectorCombine] try to form a better extractelement 2020-04-03 13:55:13 -04:00
Vectorize.cpp [VectorCombine] new IR transform pass for partial vector ops 2020-02-09 10:04:41 -05:00