[PATCH] D140119: [PowerPC][GIsel] Materialize i64 constants.

Kai Nacke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 16 08:33:35 PST 2022


Kai added a comment.

In D140119#4000412 <https://reviews.llvm.org/D140119#4000412>, @shchenz wrote:

> hmm, so many duplicated codes, but seems there is no simple way to avoid this.
>
> D139813 <https://reviews.llvm.org/D139813> adds some improvement for i64 materialization in DAG ISel. That should be adopted to GISel too.
>
> This reminds me there was a proposal (https://reviews.llvm.org/D82709#2137837) for PPC target that PPC can materialize the i64 imm after ISEL and in ISEL just lower the i64 imm to a pseudo instruction. So we can avoid the duplication here and also some other remat issue in register allocation. But that may require big effort...

I agree that the code duplication is unfortune. There is also the comment in `PPCInstrInfo::materializeImmPostRA()`:

  // FIXME: Materialization here is not optimal.
  // For some special bit patterns we can use less instructions.
  // See `selectI64ImmDirect` in PPCISelDAGToDAG.cpp.

Well, we would need:

- a new pseudo instruction loadimmi64
- a pass to expand the pseudo after ISEL
- in best case the implementation is shareable with `materializeImmPostRA()`

Sounds doable.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140119



More information about the llvm-commits mailing list