[llvm] r268005 - [LoopDist] Pass 'Function' to main class. NFC

Adam Nemet via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 29 00:10:40 PDT 2016


Author: anemet
Date: Fri Apr 29 02:10:39 2016
New Revision: 268005

URL: http://llvm.org/viewvc/llvm-project?rev=268005&view=rev
Log:
[LoopDist] Pass 'Function' to main class. NFC

Next patch will add another use for 'Function' inside the class.

Modified:
    llvm/trunk/lib/Transforms/Scalar/LoopDistribute.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/LoopDistribute.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopDistribute.cpp?rev=268005&r1=268004&r2=268005&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopDistribute.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopDistribute.cpp Fri Apr 29 02:10:39 2016
@@ -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<ConstantInt>(*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.




More information about the llvm-commits mailing list