[PATCH] D89423: Explicitly check for entry basic block, rather than relying on MachineBasicBlock::pred_empty.

Sriraman Tallam via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 14 22:18:40 PDT 2020


tmsriram added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:3092
   // Print the main label for the block.
-  if (MBB.pred_empty() ||
-      (!MF->hasBBLabels() && isBlockOnlyReachableByFallthrough(&MBB) &&
-       !MBB.isEHFuncletEntry() && !MBB.hasLabelMustBeEmitted())) {
+  if ((!MBB.isEntryBlock() && (MF->hasBBLabels() || MBB.isBeginSection())) ||
+      (!MBB.pred_empty() &&
----------------
I think this would require a lot more comments.  I see that you have flipped the if-else here, is there any reason you did that. Plus, there are a lot more checks than earlier.  Could you add  more comments that explain what is going on here?  Thanks.  


================
Comment at: llvm/lib/CodeGen/MachineBasicBlock.cpp:270
+bool MachineBasicBlock::isEntryBlock() const {
+  return getParent()->begin() == getIterator();
+}
----------------
Is this the same as getParent()->front() == this?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89423



More information about the llvm-commits mailing list