[PATCH] D36734: [PowerPC Peephole] Constants into a join add, use ADDI over LI/ADD.

Tony Jiang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 7 11:44:46 PDT 2017


jtony marked 5 inline comments as done.
jtony added inline comments.


================
Comment at: lib/Target/PowerPC/PPCMIPeephole.cpp:366
+
+      case PPC::ADD4:
+      case PPC::ADD8: {
----------------
inouehrs wrote:
> Why specific to add?
> Don't we have much optimization opportunity for arithmetic operations other than add?
Discussed in our scrum, we don't want to do this for now.


================
Comment at: lib/Target/PowerPC/PPCMIPeephole.cpp:375
+
+          if (!MRI->hasOneNonDBGUse(DefPhiMI->getOperand(0).getReg()))
+            return false;
----------------
inouehrs wrote:
> ```
> return DefPhiMI && (DefPhiMI->getOpcode() != PPC::PHI &&
>        MRI->hasOneNonDBGUse(DefPhiMI->getOperand(0).getReg());
> ```
> might be clearer (but its up to your preference.)
That's indeed a good idea, I will change it. But the code you provided has a small error in it. It should be DefPhiMI->getOpcode() == PPC::PHI, i.e.

return DefPhiMI && (DefPhiMI->getOpcode() == PPC::PHI &&
       MRI->hasOneNonDBGUse(DefPhiMI->getOperand(0).getReg());


https://reviews.llvm.org/D36734





More information about the llvm-commits mailing list