[PATCH] D69497: [PowerPC] Fix MI peephole optimization for splats

Nemanja Ivanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 28 06:39:28 PDT 2019


nemanjai requested changes to this revision.
nemanjai added a comment.
This revision now requires changes to proceed.

Thank you for fixing this. I agree with Kai that we should simplify the logic here. We should not make assumptions about physical registers in general so we should just exit early here if either of the input registers are not virtual registers.



================
Comment at: llvm/lib/Target/PowerPC/PPCMIPeephole.cpp:388
-                TRI->lookThruCopyLike(DefMI->getOperand(2).getReg(), MRI);
+              bool FeedRegsSame = areFeedRegsSame(DefMI, MRI);
 
-              if ((FeedImmed == 0 || FeedImmed == 3) && FeedReg1 == FeedReg2) {
----------------
Yes as Kai pointed out, we should just add
```
if (!Register::isVirtualRegister(FeedReg1) ||
    !Register::isVirtualRegister(FeedReg2))
  break;
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69497





More information about the llvm-commits mailing list