[PATCH] D65267: [PowerPC][PreEmitPeephole] Remove redundant copies of immediate numbers after TailDup

Jinsong Ji via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 13 07:36:21 PDT 2019


jsji added a comment.

> If I implement it in machine-cp, I might write some like `isMoveImmediate` and invoke target hook like `TII->FoldImmediate`. However currently only `PowerPC` implements specific `TII->FoldImmediate`. Taking above into account, this issues seems not general enough to implement in machine-cp.

I don't see this is specific to 'isMoveImmediate`.

  //   $reg0 = OP ....
  // ...
  //   $reg1 = COPY $reg0

If we can be sure that `$reg0` is renamable, and no use of `$reg0` or `$reg1` in between (and of course there might be other restrictions, like ReservedReg etc),
we should be able to remove the COPY here.

  // `$reg1` = OP ..
  // ...

`LI $r,0` in your testcase is just a typical example here.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D65267





More information about the llvm-commits mailing list