[PATCH] D138899: [PowerPC] add a peephole to eliminate unnecessary load

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 28 23:13:54 PST 2022


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

For byval parameter, PPC currently will generate loads in the `lower_call()` to loads the parameter to the registers.

If there is store instruction which stores some value to the parameter in the same block, there will be load hit store issue.

This patch tries to solve this. 
Implementing this in PPC Peephole is because:
1: `lower_call` in PPC instruction selection pass has several versions for different platforms, so in peephole pass can avoid adding duplicated codes for each ABI implementation.
2: The load elimination should not be limited to a single block(even though for load-hit-store, it mostly happens in same block), for example, if we can analysis domination and alias well, it should be possible to eliminate a load in a different block with the store. So in DAG based PPC instruction selection pass, we can not extend current implementation to a function level optimization.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138899

Files:
  llvm/lib/Target/PowerPC/PPCMIPeephole.cpp
  llvm/test/CodeGen/PowerPC/byval-lhs.ll
  llvm/test/CodeGen/PowerPC/convert-load-to-copy.mir
  llvm/test/CodeGen/PowerPC/vsx-p9.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138899.478465.patch
Type: text/x-patch
Size: 8280 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221129/0306766f/attachment.bin>


More information about the llvm-commits mailing list