[PATCH] D66329: [PowerPC] [Peephole] fold frame offset by using index form to save add.
ChenZheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 15 19:38:20 PDT 2019
shchenz created this revision.
shchenz added reviewers: jsji, hfinkel, nemanjai, qshanz.
Herald added subscribers: llvm-commits, wuzish, arphaman, MaskRay, kosarev, kbarton, hiraditya.
Herald added a project: LLVM.
shchenz edited reviewers, added: steven.zhang; removed: qshanz.
Before pass PEI, all stack variables has a placeholder 0 as its offset to frame base. And in pass PEI, the real offset is filled. Like:
Before `PEI`:
renamable $x6 = ADDI8 %stack.0, 0
renamable $x6 = ADD8 killed renamable $x6, renamable $x5
STW killed renamable $r3, 4, killed renamable $x6 :: (store 4 into %ir.14, !tbaa !2)
after `PEI`:
renamable $x6 = ADDI8 $x1, -80 ;;; 0 is replaced with -80
renamable $x6 = ADD8 killed renamable $x6, renamable $x5
STW killed renamable $r3, 4, killed renamable $x6 :: (store 4 into %ir.14, !tbaa !2)
After PEI there is a peephole opt opportunity to combine above -80 in `ADDI8` with 4 in the `STW` to eliminate unnecessary `ADD8`.
So for above case, optimized instruction should be like:
renamable $x6 = ADDI8 $x1, -76
STWX killed renamable $r3, renamable $x5, killed renamable $x6 :: (store 4 into %ir.6, !tbaa !2)
This patch is to implement such peephole opt.
https://reviews.llvm.org/D66329
Files:
llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
llvm/lib/Target/PowerPC/PPCInstrInfo.h
llvm/lib/Target/PowerPC/PPCPreEmitPeephole.cpp
llvm/lib/Target/PowerPC/PPCRegisterInfo.h
llvm/test/CodeGen/PowerPC/fold-frame-offset-using-rr.mir
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66329.215527.patch
Type: text/x-patch
Size: 12193 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190816/6ca5fcef/attachment.bin>
More information about the llvm-commits
mailing list