[PATCH] D31843: [LCSSA] Try to not walk the dominator tree more than necessary
Daniel Berlin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 10 12:10:09 PDT 2017
dberlin added inline comments.
================
Comment at: lib/Transforms/Utils/LCSSA.cpp:285
+ // outside the loop. If so, put them into the worklist to rewrite those uses.
+ for (BasicBlock *BB : LoopTrav) {
+ bool DoesDominate = false;
----------------
Just to record ideas (i'll review the code in a sec)
You could actually do a little better here:
If you sort looptrav in *level* order, you can just remove the exit above you from the set once you get to a greater level number, instead of trying to skip it.
You can actually do even better than that if you want - you can do what we do with valuedfs's:
You can sort the exits and the loop traversal into dom-tree DFS number order, in the same list.
Walk through them both at once with a stack.
Push loop traversal blocks onto the stack, pop them when they no longer dominate the thing you are looking at (either exit or loop traversal)
Every exit you come across must be processed for all loop blocks still on the stack after popping to get to the right dominance scope.
(dominance is transitive, so if a dominates b, and b dominates c, a dominates c)
https://reviews.llvm.org/D31843
More information about the llvm-commits
mailing list