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

Kai Luo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 22 21:27:37 PDT 2022


lkail added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/PPCCTRLoops.cpp:99
+  for (auto ML : MLI) {
+    if (!ML->getParentLoop())
+      Changed |= processLoop(ML);
----------------
nit: Check `isOutermost`.


================
Comment at: llvm/lib/Target/PowerPC/PPCCTRLoops.cpp:114
+
+  if (MI->getDesc().isCall())
+    return true;
----------------
shchenz wrote:
> 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`
Normal call should be covered by checking regmask. Another thing I'm concerned about is indirect branch by `bctr`. We should add test to ensure bailing out if indirect branch is involved.


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