[PATCH] D48256: Fix bug to merge away entry block and update DT correctly.

Xin Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 17 12:38:05 PDT 2018


trentxintong added inline comments.


================
Comment at: lib/Transforms/Utils/Local.cpp:718
+  // Entry block does not have IDom.
+  if (DT && !ReplaceEntryBB) {
     // For some irreducible CFG we end up having forward-unreachable blocks
----------------
davide wrote:
> I'm a little confused by this comment. Isn't always the case that the entry block has no idom by definition of dominator tree?
I should add "Entry block does not have IDom, do not attempt to getIDom() on it.
The problem with the code is we try to hook up the IDom of PredBB with dominator tree node of DestBB. But if PredBB is entry block, it does not have IDom , we need to recompute.


================
Comment at: unittests/Transforms/Utils/Local.cpp:221
+        br label %bb2.i
+      bb2.i:                                            ; preds = %bb4.i, %entry
+        br label %base2flt.exit204
----------------
davide wrote:
> The predecessors list here looks wrong?
Yes, I will fix that.


Repository:
  rL LLVM

https://reviews.llvm.org/D48256





More information about the llvm-commits mailing list