[PATCH] D146610: [DAGCombiner][SelectionDAG] Apply CombineStoreAndExtract on constant values

Ting Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 22 00:13:15 PDT 2023


tingwang created this revision.
tingwang added reviewers: shchenz, nemanjai, lkail, qiucf, RKSimon, PowerPC.
tingwang added a project: LLVM.
Herald added subscribers: kbarton, hiraditya.
Herald added a project: All.
tingwang requested review of this revision.
Herald added a subscriber: llvm-commits.

Given there is a constant vector and constant scalar both are stored under the same root node, if the scalar happens to bit wise match some specific vector element, then backend may reuse vector element for the scalar store.

It seems inevitable that I need to search through store values. That kind of search is already conducted in `getStoreMergeCandidates()`, so I think it maybe a good place to push some addition search logic.

I added `shouldReuseConstVectorForExtractStore()` to bail out early if backend does not need this kind of combine.

One hack I feel like have to do is to get `EXTRACT_VECTOR_ELT` node from DAG under some condition. Without that I'm afraid cannot form the pattern for instruction selection. Let me know if there is any other way to achieve this in DAG. Thank you!


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146610

Files:
  llvm/include/llvm/CodeGen/TargetLowering.h
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  llvm/lib/Target/PowerPC/PPCISelLowering.h
  llvm/test/CodeGen/PowerPC/const-nonsplat-array-init.ll
  llvm/test/CodeGen/PowerPC/const-splat-array-init.ll
  llvm/test/CodeGen/PowerPC/memset-tail.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146610.507250.patch
Type: text/x-patch
Size: 73062 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230322/bec4c474/attachment.bin>


More information about the llvm-commits mailing list