[PATCH] D112226: [TailDuplicator] Fix merging block with terminator

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 22 03:31:25 PDT 2021


foad added inline comments.


================
Comment at: llvm/lib/CodeGen/TailDuplicator.cpp:974
+    } else {
+      LLVM_DEBUG(dbgs() << "Abort merging blocks, the predecessor still "
+                           "contains terminator instructions");
----------------
sebastian-ne wrote:
> foad wrote:
> > Isn't there a danger that this will fall through to the code that updates phi nodes, even though we didn't merge anything?
> No, this is just another condition for the if conditions above. I couldn’t add it there because `TII->removeBranch` needs to run first.
> The phi updates only run for blocks in `TDBBs` and `PrevBB` is only added there inside the if.
But if TII->removeBranch returns true and then there are still tail instructions, this function will not return at line 984. What am I missing? Maybe it's impossible for there to be tail instructions after a branch is removed?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112226



More information about the llvm-commits mailing list