[PATCH] D132394: [NFC][PowerPC] Clean up a couple of lambdas from the PPCMIPeephole.
Nemanja Ivanovic via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 23 04:04:27 PDT 2022
nemanjai accepted this revision.
nemanjai added a comment.
This revision is now accepted and ready to land.
I don't think another review cycle is needed to address the slight change I proposed.
================
Comment at: llvm/lib/Target/PowerPC/PPCMIPeephole.cpp:792-797
+ if (MI.getOpcode() == PPC::EXTSH8 ||
+ MI.getOpcode() == PPC::EXTSH8_32_64) {
+ if (SrcOpcode == PPC::LHZX) Opc = PPC::LHAX8;
+ else Opc = PPC::LHA8;
+ } else if (SrcOpcode == PPC::LHZX)
+ Opc = PPC::LHAX;
----------------
I think that even converting the lambdas into just Boolean variables might make it more readable. Something like:
```
bool SourceIsXForm = SrcOpcode == PPC::LHZX;
bool MIIs64Bit = MI.getOpcode() == PPC::EXTSH8 ||
MI.getOpcode() == PPC::EXTSH8_32_64;
if (SourceIsXForm && MIIs64Bit)
Opc = PPC::LHAX8;
else if (SourceIsXForm && !MIIs64Bit)
Opc = PPC::LHAX;
else if (MIIs64Bit)
Opc = PPC::LHA8;
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132394/new/
https://reviews.llvm.org/D132394
More information about the llvm-commits
mailing list