[PATCH] D35609: [LICM] Make sinkRegion and hoistRegion non-recursive
Davide Italiano via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 19 18:27:11 PDT 2017
davide added inline comments.
================
Comment at: lib/Transforms/Scalar/LICM.cpp:349
+ for (DomTreeNode *Child : DTN->getChildren())
+ add_region_to_worklist(Child);
+ }
----------------
sanjoy wrote:
> Not sure that the lambda is actually useful here -- why not just:
>
> ```
> if (CurLoop->contains(Child->getBlock()))
> Worklist.push_back(CurLoop);
> ```
> ?
>
> If you wanted to go a bit further, I'd say even
>
> ```
> for (size_t i = 0; i < Worklist.size(); i++)
> copy_if(Worklist[i]->getChildren(), <lambda to check if node is in loop>, std::back_inserter(Worklist));
> ```
>
> may work.
I personally find the lambda version slightly more readable.
https://reviews.llvm.org/D35609
More information about the llvm-commits
mailing list