[PATCH] D131316: [LoongArch] Implement branch analysis

Sergei Barannikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 6 11:40:31 PDT 2022


barannikov88 added a comment.

Just passed by, you can ignore my comments.



================
Comment at: llvm/lib/Target/LoongArch/LoongArchInstrInfo.cpp:168
+  // If AllowModify is true, we can erase any terminators after
+  // FirstUncondOrIndirectBR.
+  if (AllowModify && FirstUncondOrIndirectBr != MBB.end()) {
----------------
How is this possible to have instructions after an unconditional terminator? I think it should be asserted that there are none.


================
Comment at: llvm/lib/Target/LoongArch/LoongArchInstrInfo.cpp:179
+  // in an indirect branch.
+  if (NumTerminators > 2 || I->getDesc().isIndirectBranch())
+    return true;
----------------
This check seems superfluous, the code below will filter out this case.


================
Comment at: llvm/lib/Target/LoongArch/LoongArchInstrInfo.cpp:216
+      !I->getDesc().isConditionalBranch())
+    return 0;
+
----------------
This is impossible condition, because this function is only called if analyzeBranch returned success, and that returns success only if the last instruction was an (un-)conditional branch.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131316



More information about the llvm-commits mailing list