[PATCH] D105661: [PowerPC] Add frame index alignment check if the the addressing mode is DS/DQ-Form, and fall back to X-Form if necessary.

Nemanja Ivanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 10 09:04:24 PDT 2021


nemanjai accepted this revision.
nemanjai added a comment.
This revision is now accepted and ready to land.

My comments are stylistic so I don't have a problem with you addressing it on the commit without another review. LGTM.



================
Comment at: llvm/lib/Target/PowerPC/PPCISelLowering.cpp:17338
+                                   PPC::AddrMode &Mode) {
+  if (FrameIndexSDNode *FI = dyn_cast<FrameIndexSDNode>(N)) {
+    if (Mode == PPC::AM_DSForm && !(Flags & PPC::MOF_RPlusSImm16Mult4))
----------------
This is kind of minor, but when the whole function is inside a conditional block, it should probably just be an early return. You also don't really need a `dyn_cast` there - as far as I can tell you don't use `FI`. Probably a simple
```
if (!isa<FrameIndexSDNode>(N))
  return;
```
should suffice.


================
Comment at: llvm/lib/Target/PowerPC/PPCISelLowering.cpp:17339-17341
+    if (Mode == PPC::AM_DSForm && !(Flags & PPC::MOF_RPlusSImm16Mult4))
+      Mode = PPC::AM_XForm;
+    if (Mode == PPC::AM_DQForm && !(Flags & PPC::MOF_RPlusSImm16Mult16))
----------------
This can just be an or of the two conditions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105661



More information about the llvm-commits mailing list