[PATCH] D37730: [PowerPC] eliminate unconditional branch to the next instruction

Hiroshi Inoue via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 25 09:23:46 PDT 2017


inouehrs marked an inline comment as done.
inouehrs added inline comments.


================
Comment at: lib/Target/PowerPC/PPCInstrInfo.cpp:491
+    MachineFunction::iterator BBI = MBB.getIterator();
+    MachineFunction::iterator NextBBI = std::next(BBI);
+    // If the BB end with an unconditional branch to the fallthrough BB,
----------------
nemanjai wrote:
> This makes the assumption that the blocks are ordered in in the `MachineFunction` in the same order in which they'll be emitted. Can you add a comment with a quick explanation of why you're allowed to make that assumption.
I added a comment.
I am assuming that we can always find fallthrough BB based on `MachineFunction::iterator` in machine IR. Is there any case that we cannot assume so?


================
Comment at: lib/Target/PowerPC/PPCInstrInfo.cpp:492
+    MachineFunction::iterator NextBBI = std::next(BBI);
+    // If the BB end with an unconditional branch to the fallthrough BB,
+    // we eliminate it.
----------------
nemanjai wrote:
> 1. s/end/ends
> 2. s/we eliminate it/we eliminate the branch instruction
> 
> The reason for 2. is that there's a bit of confusion of the subject of the sentence - it sounds like we're removing the basic block rather than the branch instruction.
Thanks for the suggestion.


https://reviews.llvm.org/D37730





More information about the llvm-commits mailing list