[llvm] 19885c7 - [NFC] Remove duplicate function calls

Max Kazantsev via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 7 03:02:56 PDT 2021


Author: Max Kazantsev
Date: 2021-07-07T17:02:36+07:00
New Revision: 19885c7adf550ecaaf6191f45c5279d45290ca08

URL: https://github.com/llvm/llvm-project/commit/19885c7adf550ecaaf6191f45c5279d45290ca08
DIFF: https://github.com/llvm/llvm-project/commit/19885c7adf550ecaaf6191f45c5279d45290ca08.diff

LOG: [NFC] Remove duplicate function calls

Removed repeated call of L->getHeader(). Now using previously stored return value.

Patch by Dmitry Makogon!

Differential Revision: https://reviews.llvm.org/D105535
Reviewed By: mkazantsev

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/LoopDeletion.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/LoopDeletion.cpp b/llvm/lib/Transforms/Scalar/LoopDeletion.cpp
index eee97a54057d..573dc5438251 100644
--- a/llvm/lib/Transforms/Scalar/LoopDeletion.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopDeletion.cpp
@@ -228,7 +228,7 @@ static bool canProveExitOnFirstIteration(Loop *L, DominatorTree &DT,
   SmallPtrSet<BasicBlock *, 4> LiveBlocks;
   // Edges that are reachable on the 1st iteration.
   DenseSet<BasicBlockEdge> LiveEdges;
-  LiveBlocks.insert(L->getHeader());
+  LiveBlocks.insert(Header);
 
   SmallPtrSet<BasicBlock *, 4> Visited;
   auto MarkLiveEdge = [&](BasicBlock *From, BasicBlock *To) {
@@ -286,7 +286,7 @@ static bool canProveExitOnFirstIteration(Loop *L, DominatorTree &DT,
   //     iteration, mark this successor live.
   // 3b. If we cannot prove it, conservatively assume that all successors are
   //     live.
-  auto &DL = L->getHeader()->getModule()->getDataLayout();
+  auto &DL = Header->getModule()->getDataLayout();
   const SimplifyQuery SQ(DL);
   for (auto *BB : RPOT) {
     Visited.insert(BB);


        


More information about the llvm-commits mailing list