[PATCH] D81723: [PowerPC] fold addi's imm operand to its imm form consumer's displacement

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 12 02:40:24 PDT 2020


shchenz created this revision.
shchenz added reviewers: nemanjai, steven.zhang, jsji, PowerPC.
Herald added subscribers: llvm-commits, wuzish, kbarton, hiraditya.
Herald added a project: LLVM.
shchenz edited the summary of this revision.

After `MachineSink`, there will be peephole opportunity for:

  %0:g8rc_and_g8rc_nox0 = ADDI8 %5:g8rc_and_g8rc_nox0, 144
  STD killed %7:g8rc, 16, %0:g8rc_and_g8rc_nox0 :: (store 8 into %ir.8)

------>

  STD killed %7:g8rc, 160, %5:g8rc_and_g8rc_nox0 :: (store 8 into %ir.8)

This folding opportunity may become unfoldable after RA because we may redefine addi's register operand in RA. So we add this peephole before RA in `convertToImmediateForm`.

First try was implemented in https://reviews.llvm.org/D46377 and the author @nemanjai found out that patch can use some existing logic in later committed patch https://reviews.llvm.org/D49007.

This patch tries to do this.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81723

Files:
  llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
  llvm/lib/Target/PowerPC/PPCInstrInfo.h
  llvm/test/CodeGen/PowerPC/convert-ri-addi-to-ri.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81723.270327.patch
Type: text/x-patch
Size: 9981 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200612/58794348/attachment.bin>


More information about the llvm-commits mailing list