From 4338d6769e8c47b66ba6224caab7463a6faa5be5 Mon Sep 17 00:00:00 2001 From: Adam Nemet Date: Fri, 29 Apr 2016 07:10:39 +0000 Subject: [LoopDist] Pass 'Function' to main class. NFC Next patch will add another use for 'Function' inside the class. llvm-svn: 268005 --- llvm/lib/Transforms/Scalar/LoopDistribute.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'llvm/lib/Transforms') diff --git a/llvm/lib/Transforms/Scalar/LoopDistribute.cpp b/llvm/lib/Transforms/Scalar/LoopDistribute.cpp index 3b484f31acc..50df14de866 100644 --- a/llvm/lib/Transforms/Scalar/LoopDistribute.cpp +++ b/llvm/lib/Transforms/Scalar/LoopDistribute.cpp @@ -588,9 +588,10 @@ private: /// \brief The actual class performing the per-loop work. class LoopDistributeForLoop { public: - LoopDistributeForLoop(Loop *L, LoopInfo *LI, const LoopAccessInfo &LAI, - DominatorTree *DT, ScalarEvolution *SE) - : L(L), LI(LI), LAI(LAI), DT(DT), SE(SE) { + LoopDistributeForLoop(Loop *L, Function *F, LoopInfo *LI, + const LoopAccessInfo &LAI, DominatorTree *DT, + ScalarEvolution *SE) + : L(L), F(F), LI(LI), LAI(LAI), DT(DT), SE(SE) { setForced(); } @@ -746,7 +747,6 @@ public: /// \brief Provide diagnostics then \return with false. bool fail(llvm::StringRef Message) { - Function *F = L->getHeader()->getParent(); LLVMContext &Ctx = F->getContext(); bool Forced = isForced().getValueOr(false); @@ -834,8 +834,10 @@ private: IsForced = mdconst::extract(*Op)->getZExtValue(); } - // Analyses used. Loop *L; + Function *F; + + // Analyses used. LoopInfo *LI; const LoopAccessInfo &LAI; DominatorTree *DT; @@ -886,7 +888,7 @@ public: bool Changed = false; for (Loop *L : Worklist) { const LoopAccessInfo &LAI = LAA->getInfo(L, ValueToValueMap()); - LoopDistributeForLoop LDL(L, LI, LAI, DT, SE); + LoopDistributeForLoop LDL(L, &F, LI, LAI, DT, SE); // If distribution was forced for the specific loop to be // enabled/disabled, follow that. Otherwise use the global flag. -- cgit v1.2.3