[llvm] [MIRPrinter] Don't print line break when there is no instructions (PR #80147)

Quentin Dian via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 1 02:24:59 PST 2024


================
@@ -728,7 +728,7 @@ void MIPrinter::print(const MachineBasicBlock &MBB) {
     HasLineAttributes = true;
   }
 
-  if (HasLineAttributes)
+  if (HasLineAttributes && !MBB.instrs().empty())
----------------
DianQK wrote:

> Makes sense to me: you only need the blank line separator if there are some successors/liveins _and_ some instructions.

`HasLineAttributes` should already contain successors and liveins.

https://github.com/llvm/llvm-project/pull/80147


More information about the llvm-commits mailing list