[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
Thu Oct 15 14:52:29 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 (shouldEmitLabelForBasicBlock(MBB)) {
+ if (isVerbose() && MBB.hasLabelMustBeEmitted())
----------------
Should we keep the same order as before? Any reason to flip it? I don't have a strong opinion but the change is simpler.
================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:3142
+/// shouldEmitLabelForBasicBlock - Return true if the given basic block requires
+/// basic block label. The symbol is constructed later by a call to
+/// MachineBasicBlock::getSymbol and may assume different names under various
----------------
================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:3144
+/// MachineBasicBlock::getSymbol and may assume different names under various
+/// circumstances.
+bool AsmPrinter::shouldEmitLabelForBasicBlock(
----------------
"assume different names under various circumstances" , please rephrase.
================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:3147
+ const MachineBasicBlock &MBB) const {
+ // With -basic-block-sections, a label is needed for every non-entry block in
+ // the 'labels' mode and every section beginning in the 'sections' mode.
----------------
================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:3148
+ // With -basic-block-sections, a label is needed for every non-entry block in
+ // the 'labels' mode and every section beginning in the 'sections' mode.
+ if ((MF->hasBBLabels() || MBB.isBeginSection()) && !MBB.isEntryBlock())
----------------
================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:3152
+ // A label is needed for any block with at least one predecessor (when that
+ // predecessor is not the fallthrough predecessor, or if other conditions are
+ // met).
----------------
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