[llvm] 4a161bd - LoopUnroll.cpp - pass std::vector by const reference to needToInsertPhisForLCSSA helper. NFCI.
Roman Lebedev via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 30 10:19:35 PDT 2020
On Thu, Jul 30, 2020 at 8:17 PM Simon Pilgrim via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
>
>
> Author: Simon Pilgrim
> Date: 2020-07-30T18:17:04+01:00
> New Revision: 4a161bd8b3c2c31da788072b9641e1dcde62ce08
>
> URL: https://github.com/llvm/llvm-project/commit/4a161bd8b3c2c31da788072b9641e1dcde62ce08
> DIFF: https://github.com/llvm/llvm-project/commit/4a161bd8b3c2c31da788072b9641e1dcde62ce08.diff
>
> LOG: LoopUnroll.cpp - pass std::vector by const reference to needToInsertPhisForLCSSA helper. NFCI.
>
> Avoid an unnecessary pass by value.
>
> Added:
>
>
> Modified:
> llvm/lib/Transforms/Utils/LoopUnroll.cpp
>
> Removed:
>
>
>
> ################################################################################
> diff --git a/llvm/lib/Transforms/Utils/LoopUnroll.cpp b/llvm/lib/Transforms/Utils/LoopUnroll.cpp
> index 3875c631f839..8e8aeea15dbf 100644
> --- a/llvm/lib/Transforms/Utils/LoopUnroll.cpp
> +++ b/llvm/lib/Transforms/Utils/LoopUnroll.cpp
> @@ -108,14 +108,15 @@ UnrollVerifyDomtree("unroll-verify-domtree", cl::Hidden,
> /// insert a phi-node, otherwise LCSSA will be broken.
> /// The function is just a helper function for llvm::UnrollLoop that returns
> /// true if this situation occurs, indicating that LCSSA needs to be fixed.
> -static bool needToInsertPhisForLCSSA(Loop *L, std::vector<BasicBlock *> Blocks,
> +static bool needToInsertPhisForLCSSA(Loop *L,
> + const std::vector<BasicBlock *> &Blocks,
Better yet, take ArrayRef<BasicBlock *> ?
> LoopInfo *LI) {
> for (BasicBlock *BB : Blocks) {
> if (LI->getLoopFor(BB) == L)
> continue;
> for (Instruction &I : *BB) {
> for (Use &U : I.operands()) {
> - if (auto Def = dyn_cast<Instruction>(U)) {
> + if (const auto *Def = dyn_cast<Instruction>(U)) {
> Loop *DefLoop = LI->getLoopFor(Def->getParent());
> if (!DefLoop)
> continue;
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list