[PATCH] D122125: [PowerPC] generate CTR loops instructions after ISEL

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 22 21:02:39 PDT 2022


shchenz added a comment.

Thanks for review @lkail , updated accordingly.



================
Comment at: llvm/lib/Target/PowerPC/PPCCTRLoops.cpp:114
+
+  if (MI->getDesc().isCall())
+    return true;
----------------
lkail wrote:
> Why would a `Call` read CTR register?
CTR is a volatile register, this is not for the `Call` itself, it is also for the callee function. Inside the callee, we may read the CTR with `mfctr` or other similar instructions. 

But `Call` may also clobber the CTR, we should check `isCall` before `!CheckReads`


================
Comment at: llvm/lib/Target/PowerPC/PPCCTRLoops.cpp:153
+  MachineInstr *Dec = nullptr;
+  bool Revert = false;
+
----------------
lkail wrote:
> Can we rename `Revert` to something like `InvalidCTRLoop`? `Revert` sounds like we have performed part of transformation, then rollback.
Sure, good idea.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122125



More information about the llvm-commits mailing list