[PATCH] D158836: [LoopVectorize] Vectorize the compact pattern

Tiehu Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 25 04:27:30 PDT 2023


TiehuZhang created this revision.
TiehuZhang added reviewers: fhahn, sdesmalen, dmgreen.
Herald added subscribers: artagnon, shiva0217, sunshaoce, StephenFan, rogfer01, hiraditya.
Herald added a project: All.
TiehuZhang requested review of this revision.
Herald added subscribers: llvm-commits, wangpc, vkmr.
Herald added a project: LLVM.

This patch tries to vectorize the compact pattern, as shown,

  
  for(i=0; i<N; i++){
     x = comp[i];
     if(x<a) Out_ref[n++]=B[i];
  }


It introduces some changes:

1. Add a pattern matching in LoopVectorizationLegality to cache specific cases.
2. Introduce two new recipes to hande the compact chain: VPCompactPHIRecipe: Handle the entry PHI of compact chain. VPWidenCompactInstructionRecipe: Handle other instructions in compact chain.
3. Slightly adapt the cost model for compact pattern.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158836

Files:
  llvm/include/llvm/Analysis/TargetTransformInfo.h
  llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
  llvm/include/llvm/CodeGen/BasicTTIImpl.h
  llvm/include/llvm/Transforms/Utils/LoopUtils.h
  llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
  llvm/lib/Analysis/TargetTransformInfo.cpp
  llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
  llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
  llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
  llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
  llvm/lib/Transforms/Utils/LoopUtils.cpp
  llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h
  llvm/lib/Transforms/Vectorize/VPlan.cpp
  llvm/lib/Transforms/Vectorize/VPlan.h
  llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
  llvm/lib/Transforms/Vectorize/VPlanValue.h
  llvm/test/Transforms/LoopVectorize/AArch64/compact-vplan.ll
  llvm/test/Transforms/LoopVectorize/AArch64/compact.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158836.553436.patch
Type: text/x-patch
Size: 53603 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230825/41230842/attachment.bin>


More information about the llvm-commits mailing list