[PATCH] D69168: [PowerPC] Fold redundant load immediates of zero and delete if possible

Nemanja Ivanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 6 07:59:28 PST 2019


nemanjai requested changes to this revision.
nemanjai added inline comments.
This revision now requires changes to proceed.


================
Comment at: llvm/lib/Target/PowerPC/PPCMIPeephole.cpp:329
+        Simplified |= Folded;
+        if (MRI->use_nodbg_empty(MIDestReg) && Folded) {
+          ++NumLoadImmZeroFoldedAndRemoved;
----------------
stefanp wrote:
> Why do you need to check `&& Folded` here? The output register of this `LI` instruction has no non-debug uses so you can probably just schedule it to be deleted anyway. If you do that you also don't need to keep `Folded` around and just do what Nemanja mentioned:
> ```
> Simplified |=
>   TII->FoldImmediateWithoutDelete(UseMI, MI, MIDestReg, MRI);
> ```
In fact, as implemented, `Folded` will be set to whatever `TII->onlyFoldImmediate()` returns for the **last** use which may be `false` even if you have folded it in some previous uses. This needs to be fixed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69168





More information about the llvm-commits mailing list