[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
Mon Sep 2 21:10:37 PDT 2019


shchenz added a comment.

In D66329#1651489 <https://reviews.llvm.org/D66329#1651489>, @stefanp wrote:

> I like what this patch is doing. Overall, I only have some refactoring comments.
>
> I do think that there are more opportunities here (however they may be a separate patch):
>
>   renamable $x6 = ADDI8 $x1, -80
>   renamable $x7 = ADD8 (killed?) renamable $x6, renamable $x5   ;; x6 here may or may not be killed...
>   STW killed renamable $r3, 4, killed renamable $x7 :: (store 4 into %ir.14, !tbaa !2)
>
>
> Can also be turned into this:
>
>   [renamable $x6 = ADDI8 $x1, -80] ? ;; May or may not be there...
>   renamable $x7 = ADD8 $x1, renamable $x5
>   STW killed renamable $r3, -76, killed renamable $x7 :: (store 4 into %ir.14, !tbaa !2)
>
>
> There are some advantages to using this approach too:
>
> 1. You don't need an XForm for the Store. You keep the same D form instruction.
> 2. You don't need to have the result of ADDI killed. If it is killed you can remove the instruction. If it is not killed you leave it but you still win even if you leave it because you have broken the dependency between the two instructions. One disadvantage that I can see:
> 3. Some loads/stores require the immediate to be aligned in some way which will limit which immediates you can use for them.
>
>   My suggestion is more of an addition to what you already have. I think what you have and what I was describing will catch different opportunities.


Yes, this is indeed an opportunity for stack variables to save one ADDI. Thanks for pointing it out. This seems not easy to mix together with current patch since this patch will convert dform to xform while above opportunity does not require load/store form changing.

Maybe need to implement it in another patch.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66329/new/

https://reviews.llvm.org/D66329





More information about the llvm-commits mailing list