LoopUnroll.cpp - pass std::vector by const reference to needToInsertPhisForLCSSA...
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 30 Jul 2020 16:37:57 +0000 (17:37 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 30 Jul 2020 17:17:04 +0000 (18:17 +0100)
Avoid an unnecessary pass by value.

llvm/lib/Transforms/Utils/LoopUnroll.cpp

index 3875c631f839b36ff7b4aedbf83ae6273942ac14..8e8aeea15dbf90655e8397f67a1852e7b0a93fae 100644 (file)
@@ -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,
                                      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;