From 19885c7adf550ecaaf6191f45c5279d45290ca08 Mon Sep 17 00:00:00 2001 From: Max Kazantsev Date: Wed, 7 Jul 2021 17:00:48 +0700 Subject: [PATCH] [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 --- llvm/lib/Transforms/Scalar/LoopDeletion.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 LiveBlocks; // Edges that are reachable on the 1st iteration. DenseSet LiveEdges; - LiveBlocks.insert(L->getHeader()); + LiveBlocks.insert(Header); SmallPtrSet 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);