[PATCH] D17473: [LoopUnroll] Avoid unnecessary DT recomputation.

Michael Zolotukhin via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 19 19:29:16 PST 2016


mzolotukhin added a comment.

Thanks for the feedback, I'll update the patch soon.

Michael


================
Comment at: lib/Transforms/Utils/LoopUnroll.cpp:536
@@ +535,3 @@
+            ExitIDom ? DT->findNearestCommonDominator(ExitIDom, *BI) : *BI;
+      }
+      DT->changeImmediateDominator(Exit, ExitIDom);
----------------
The reason we're doing this is that dominator for an exit block could change after unrolling. Consider a diamond-like loop body with header `H`, side blocks  `A` and `B`, and latchblock  `L`. Suppose `B` is exiting to `E`.

If `B` is the immediate dominator of `E` before unrolling, it's not the case after unrolling - we'll have several blocks exiting to `E`, so we have to actually find their common dominator.

Probably, there is a more efficient way of doing this, but even in this form it's a pure win over what we have now.


http://reviews.llvm.org/D17473





More information about the llvm-commits mailing list