1 //===----- ScopDetection.cpp  - Detect Scops --------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Detect the maximal Scops of a function.
11 //
12 // A static control part (Scop) is a subgraph of the control flow graph (CFG)
13 // that only has statically known control flow and can therefore be described
14 // within the polyhedral model.
15 //
16 // Every Scop fullfills these restrictions:
17 //
18 // * It is a single entry single exit region
19 //
20 // * Only affine linear bounds in the loops
21 //
22 // Every natural loop in a Scop must have a number of loop iterations that can
23 // be described as an affine linear function in surrounding loop iterators or
24 // parameters. (A parameter is a scalar that does not change its value during
25 // execution of the Scop).
26 //
27 // * Only comparisons of affine linear expressions in conditions
28 //
29 // * All loops and conditions perfectly nested
30 //
31 // The control flow needs to be structured such that it could be written using
32 // just 'for' and 'if' statements, without the need for any 'goto', 'break' or
33 // 'continue'.
34 //
35 // * Side effect free functions call
36 //
37 // Only function calls and intrinsics that do not have side effects are allowed
38 // (readnone).
39 //
40 // The Scop detection finds the largest Scops by checking if the largest
41 // region is a Scop. If this is not the case, its canonical subregions are
42 // checked until a region is a Scop. It is now tried to extend this Scop by
43 // creating a larger non canonical region.
44 //
45 //===----------------------------------------------------------------------===//
46 
47 #include "polly/ScopDetection.h"
48 
49 #include "polly/LinkAllPasses.h"
50 #include "polly/Support/ScopHelper.h"
51 #include "polly/Support/SCEVValidator.h"
52 
53 #include "llvm/IR/LLVMContext.h"
54 #include "llvm/ADT/Statistic.h"
55 #include "llvm/Analysis/AliasAnalysis.h"
56 #include "llvm/Analysis/LoopInfo.h"
57 #include "llvm/Analysis/RegionIterator.h"
58 #include "llvm/Analysis/ScalarEvolution.h"
59 #include "llvm/Analysis/ScalarEvolutionExpressions.h"
60 #include "llvm/DebugInfo.h"
61 #include "llvm/Support/CommandLine.h"
62 #include "llvm/Assembly/Writer.h"
63 
64 #define DEBUG_TYPE "polly-detect"
65 #include "llvm/Support/Debug.h"
66 
67 #include <set>
68 
69 using namespace llvm;
70 using namespace polly;
71 
72 static cl::opt<std::string>
73 OnlyFunction("polly-detect-only",
74              cl::desc("Only detect scops in function"), cl::Hidden,
75              cl::value_desc("The function name to detect scops in"),
76              cl::ValueRequired, cl::init(""));
77 
78 static cl::opt<bool>
79 IgnoreAliasing("polly-ignore-aliasing",
80                cl::desc("Ignore possible aliasing of the array bases"),
81                cl::Hidden, cl::init(false));
82 
83 static cl::opt<bool>
84 ReportLevel("polly-report",
85             cl::desc("Print information about Polly"),
86             cl::Hidden, cl::init(false));
87 
88 static cl::opt<bool>
89 AllowNonAffine("polly-allow-nonaffine",
90                cl::desc("Allow non affine access functions in arrays"),
91                cl::Hidden, cl::init(false));
92 
93 //===----------------------------------------------------------------------===//
94 // Statistics.
95 
96 STATISTIC(ValidRegion, "Number of regions that a valid part of Scop");
97 
98 #define BADSCOP_STAT(NAME, DESC) STATISTIC(Bad##NAME##ForScop, \
99                                            "Number of bad regions for Scop: "\
100                                            DESC)
101 
102 #define INVALID(NAME, MESSAGE) \
103   do { \
104     std::string Buf; \
105     raw_string_ostream fmt(Buf); \
106     fmt << MESSAGE; \
107     fmt.flush(); \
108     LastFailure = Buf; \
109     DEBUG(dbgs() << MESSAGE); \
110     DEBUG(dbgs() << "\n"); \
111     assert(!Context.Verifying && #NAME); \
112     if (!Context.Verifying) ++Bad##NAME##ForScop; \
113     return false; \
114   } while (0);
115 
116 
117 #define INVALID_NOVERIFY(NAME, MESSAGE) \
118   do { \
119     std::string Buf; \
120     raw_string_ostream fmt(Buf); \
121     fmt << MESSAGE; \
122     fmt.flush(); \
123     LastFailure = Buf; \
124     DEBUG(dbgs() << MESSAGE); \
125     DEBUG(dbgs() << "\n"); \
126     /* DISABLED: assert(!Context.Verifying && #NAME); */ \
127     if (!Context.Verifying) ++Bad##NAME##ForScop; \
128     return false; \
129   } while (0);
130 
131 
132 BADSCOP_STAT(CFG,             "CFG too complex");
133 BADSCOP_STAT(IndVar,          "Non canonical induction variable in loop");
134 BADSCOP_STAT(LoopBound,       "Loop bounds can not be computed");
135 BADSCOP_STAT(FuncCall,        "Function call with side effects appeared");
136 BADSCOP_STAT(AffFunc,         "Expression not affine");
137 BADSCOP_STAT(Scalar,          "Found scalar dependency");
138 BADSCOP_STAT(Alias,           "Found base address alias");
139 BADSCOP_STAT(SimpleRegion,    "Region not simple");
140 BADSCOP_STAT(Other,           "Others");
141 
142 //===----------------------------------------------------------------------===//
143 // ScopDetection.
144 bool ScopDetection::isMaxRegionInScop(const Region &R) const {
145   // The Region is valid only if it could be found in the set.
146   return ValidRegions.count(&R);
147 }
148 
149 std::string ScopDetection::regionIsInvalidBecause(const Region *R) const {
150   if (!InvalidRegions.count(R))
151     return "";
152 
153   return InvalidRegions.find(R)->second;
154 }
155 
156 bool ScopDetection::isValidCFG(BasicBlock &BB,
157                                DetectionContext &Context) const {
158   Region &RefRegion = Context.CurRegion;
159   TerminatorInst *TI = BB.getTerminator();
160 
161   // Return instructions are only valid if the region is the top level region.
162   if (isa<ReturnInst>(TI) && !RefRegion.getExit() && TI->getNumOperands() == 0)
163     return true;
164 
165   BranchInst *Br = dyn_cast<BranchInst>(TI);
166 
167   if (!Br)
168     INVALID(CFG, "Non branch instruction terminates BB: " + BB.getName());
169 
170   if (Br->isUnconditional()) return true;
171 
172   Value *Condition = Br->getCondition();
173 
174   // UndefValue is not allowed as condition.
175   if (isa<UndefValue>(Condition))
176     INVALID(AffFunc, "Condition based on 'undef' value in BB: " + BB.getName());
177 
178   // Only Constant and ICmpInst are allowed as condition.
179   if (!(isa<Constant>(Condition) || isa<ICmpInst>(Condition)))
180     INVALID(AffFunc, "Condition in BB '" + BB.getName() + "' neither "
181                      "constant nor an icmp instruction");
182 
183   // Allow perfectly nested conditions.
184   assert(Br->getNumSuccessors() == 2 && "Unexpected number of successors");
185 
186   if (ICmpInst *ICmp = dyn_cast<ICmpInst>(Condition)) {
187     // Unsigned comparisons are not allowed. They trigger overflow problems
188     // in the code generation.
189     //
190     // TODO: This is not sufficient and just hides bugs. However it does pretty
191     // well.
192     if (ICmp->isUnsigned())
193       return false;
194 
195     // Are both operands of the ICmp affine?
196     if (isa<UndefValue>(ICmp->getOperand(0))
197         || isa<UndefValue>(ICmp->getOperand(1)))
198       INVALID(AffFunc, "undef operand in branch at BB: " + BB.getName());
199 
200     const SCEV *LHS = SE->getSCEV(ICmp->getOperand(0));
201     const SCEV *RHS = SE->getSCEV(ICmp->getOperand(1));
202 
203     if (!isAffineExpr(&Context.CurRegion, LHS, *SE) ||
204         !isAffineExpr(&Context.CurRegion, RHS, *SE))
205       INVALID(AffFunc, "Non affine branch in BB '" << BB.getName()
206                         << "' with LHS: " << *LHS << " and RHS: " << *RHS);
207   }
208 
209   // Allow loop exit conditions.
210   Loop *L = LI->getLoopFor(&BB);
211   if (L && L->getExitingBlock() == &BB)
212     return true;
213 
214   // Allow perfectly nested conditions.
215   Region *R = RI->getRegionFor(&BB);
216   if (R->getEntry() != &BB)
217     INVALID(CFG, "Not well structured condition at BB: " + BB.getName());
218 
219   return true;
220 }
221 
222 bool ScopDetection::isValidCallInst(CallInst &CI) {
223   if (CI.mayHaveSideEffects() || CI.doesNotReturn())
224     return false;
225 
226   if (CI.doesNotAccessMemory())
227     return true;
228 
229   Function *CalledFunction = CI.getCalledFunction();
230 
231   // Indirect calls are not supported.
232   if (CalledFunction == 0)
233     return false;
234 
235   // TODO: Intrinsics.
236   return false;
237 }
238 
239 bool ScopDetection::isValidMemoryAccess(Instruction &Inst,
240                                         DetectionContext &Context) const {
241   Value *Ptr = getPointerOperand(Inst);
242   const SCEV *AccessFunction = SE->getSCEV(Ptr);
243   const SCEVUnknown *BasePointer;
244   Value *BaseValue;
245 
246   BasePointer = dyn_cast<SCEVUnknown>(SE->getPointerBase(AccessFunction));
247 
248   if (!BasePointer)
249     INVALID(AffFunc, "No base pointer");
250 
251   BaseValue = BasePointer->getValue();
252 
253   if (isa<UndefValue>(BaseValue))
254     INVALID(AffFunc, "Undefined base pointer");
255 
256   AccessFunction = SE->getMinusSCEV(AccessFunction, BasePointer);
257 
258   if (!isAffineExpr(&Context.CurRegion, AccessFunction, *SE, BaseValue) &&
259       !AllowNonAffine)
260     INVALID(AffFunc, "Non affine access function: " << *AccessFunction);
261 
262   // FIXME: Alias Analysis thinks IntToPtrInst aliases with alloca instructions
263   // created by IndependentBlocks Pass.
264   if (isa<IntToPtrInst>(BaseValue))
265     INVALID(Other, "Find bad intToptr prt: " << *BaseValue);
266 
267   // Check if the base pointer of the memory access does alias with
268   // any other pointer. This cannot be handled at the moment.
269   AliasSet &AS =
270     Context.AST.getAliasSetForPointer(BaseValue, AliasAnalysis::UnknownSize,
271                                       Inst.getMetadata(LLVMContext::MD_tbaa));
272 
273   // INVALID triggers an assertion in verifying mode, if it detects that a SCoP
274   // was detected by SCoP detection and that this SCoP was invalidated by a pass
275   // that stated it would preserve the SCoPs.
276   // We disable this check as the independent blocks pass may create memory
277   // references which seem to alias, if -basicaa is not available. They actually
278   // do not, but as we can not proof this without -basicaa we would fail. We
279   // disable this check to not cause irrelevant verification failures.
280   if (!AS.isMustAlias() && !IgnoreAliasing)
281     INVALID_NOVERIFY(Alias,
282                      "Possible aliasing for value: " << BaseValue->getName()
283                      << "\n");
284 
285   return true;
286 }
287 
288 bool ScopDetection::hasScalarDependency(Instruction &Inst,
289                                         Region &RefRegion) const {
290   for (Instruction::use_iterator UI = Inst.use_begin(), UE = Inst.use_end();
291        UI != UE; ++UI)
292     if (Instruction *Use = dyn_cast<Instruction>(*UI))
293       if (!RefRegion.contains(Use->getParent())) {
294         // DirtyHack 1: PHINode user outside the Scop is not allow, if this
295         // PHINode is induction variable, the scalar to array transform may
296         // break it and introduce a non-indvar PHINode, which is not allow in
297         // Scop.
298         // This can be fix by:
299         // Introduce a IndependentBlockPrepare pass, which translate all
300         // PHINodes not in Scop to array.
301         // The IndependentBlockPrepare pass can also split the entry block of
302         // the function to hold the alloca instruction created by scalar to
303         // array.  and split the exit block of the Scop so the new create load
304         // instruction for escape users will not break other Scops.
305         if (isa<PHINode>(Use))
306           return true;
307       }
308 
309   return false;
310 }
311 
312 bool ScopDetection::isValidInstruction(Instruction &Inst,
313                                        DetectionContext &Context) const {
314   // Only canonical IVs are allowed.
315   if (PHINode *PN = dyn_cast<PHINode>(&Inst))
316     if (!isIndVar(PN, LI))
317       INVALID(IndVar, "Non canonical PHI node: " << Inst);
318 
319   // Scalar dependencies are not allowed.
320   if (hasScalarDependency(Inst, Context.CurRegion))
321     INVALID(Scalar, "Scalar dependency found: " << Inst);
322 
323   // We only check the call instruction but not invoke instruction.
324   if (CallInst *CI = dyn_cast<CallInst>(&Inst)) {
325     if (isValidCallInst(*CI))
326       return true;
327 
328     INVALID(FuncCall, "Call instruction: " << Inst);
329   }
330 
331   if (!Inst.mayWriteToMemory() && !Inst.mayReadFromMemory()) {
332     if (isa<AllocaInst>(Inst))
333       INVALID(Other, "Alloca instruction: " << Inst);
334 
335     return true;
336   }
337 
338   // Check the access function.
339   if (isa<LoadInst>(Inst) || isa<StoreInst>(Inst))
340     return isValidMemoryAccess(Inst, Context);
341 
342   // We do not know this instruction, therefore we assume it is invalid.
343   INVALID(Other, "Unknown instruction: " << Inst);
344 }
345 
346 bool ScopDetection::isValidBasicBlock(BasicBlock &BB,
347                                       DetectionContext &Context) const {
348   if (!isValidCFG(BB, Context))
349     return false;
350 
351   // Check all instructions, except the terminator instruction.
352   for (BasicBlock::iterator I = BB.begin(), E = --BB.end(); I != E; ++I)
353     if (!isValidInstruction(*I, Context))
354       return false;
355 
356   Loop *L = LI->getLoopFor(&BB);
357   if (L && L->getHeader() == &BB && !isValidLoop(L, Context))
358     return false;
359 
360   return true;
361 }
362 
363 bool ScopDetection::isValidLoop(Loop *L, DetectionContext &Context) const {
364   PHINode *IndVar = L->getCanonicalInductionVariable();
365   // No canonical induction variable.
366   if (!IndVar)
367     INVALID(IndVar, "No canonical IV at loop header: "
368                     << L->getHeader()->getName());
369 
370   // Is the loop count affine?
371   const SCEV *LoopCount = SE->getBackedgeTakenCount(L);
372   if (!isAffineExpr(&Context.CurRegion, LoopCount, *SE))
373     INVALID(LoopBound, "Non affine loop bound '" << *LoopCount << "' in loop: "
374                        << L->getHeader()->getName());
375 
376   return true;
377 }
378 
379 Region *ScopDetection::expandRegion(Region &R) {
380   // Initial no valid region was found (greater than R)
381   Region *LastValidRegion = NULL;
382   Region *ExpandedRegion = R.getExpandedRegion();
383 
384   DEBUG(dbgs() << "\tExpanding " << R.getNameStr() << "\n");
385 
386   while (ExpandedRegion) {
387     DetectionContext Context(*ExpandedRegion, *AA, false /* verifying */);
388     DEBUG(dbgs() << "\t\tTrying " << ExpandedRegion->getNameStr() << "\n");
389 
390     // Check the exit first (cheap)
391     if (isValidExit(Context)) {
392       // If the exit is valid check all blocks
393       //  - if true, a valid region was found => store it + keep expanding
394       //  - if false, .tbd. => stop  (should this really end the loop?)
395       if (!allBlocksValid(Context))
396         break;
397 
398       // Delete unnecessary regions (allocated by getExpandedRegion)
399       if (LastValidRegion)
400         delete LastValidRegion;
401 
402       // Store this region, because it is the greatest valid (encountered so far)
403       LastValidRegion = ExpandedRegion;
404 
405       // Create and test the next greater region (if any)
406       ExpandedRegion = ExpandedRegion->getExpandedRegion();
407 
408     } else {
409       // Create and test the next greater region (if any)
410       Region *TmpRegion = ExpandedRegion->getExpandedRegion();
411 
412       // Delete unnecessary regions (allocated by getExpandedRegion)
413       delete ExpandedRegion;
414 
415       ExpandedRegion = TmpRegion;
416     }
417   }
418 
419   DEBUG(
420   if (LastValidRegion)
421     dbgs() << "\tto " << LastValidRegion->getNameStr() << "\n";
422   else
423     dbgs() << "\tExpanding " << R.getNameStr() << " failed\n";
424   );
425 
426   return LastValidRegion;
427 }
428 
429 void ScopDetection::findScops(Region &R) {
430   DetectionContext Context(R, *AA, false /*verifying*/);
431 
432   LastFailure = "";
433 
434   if (isValidRegion(Context)) {
435     ++ValidRegion;
436     ValidRegions.insert(&R);
437     return;
438   }
439 
440   InvalidRegions[&R] = LastFailure;
441 
442   for (Region::iterator I = R.begin(), E = R.end(); I != E; ++I)
443     findScops(**I);
444 
445   // Try to expand regions.
446   //
447   // As the region tree normally only contains canonical regions, non canonical
448   // regions that form a Scop are not found. Therefore, those non canonical
449   // regions are checked by expanding the canonical ones.
450 
451   std::vector<Region*> ToExpand;
452 
453   for (Region::iterator I = R.begin(), E = R.end(); I != E; ++I)
454     ToExpand.push_back(*I);
455 
456   for (std::vector<Region*>::iterator RI = ToExpand.begin(),
457        RE = ToExpand.end(); RI != RE; ++RI) {
458     Region *CurrentRegion = *RI;
459 
460     // Skip invalid regions. Regions may become invalid, if they are element of
461     // an already expanded region.
462     if (ValidRegions.find(CurrentRegion) == ValidRegions.end())
463       continue;
464 
465     Region *ExpandedR = expandRegion(*CurrentRegion);
466 
467     if (!ExpandedR)
468       continue;
469 
470     R.addSubRegion(ExpandedR, true);
471     ValidRegions.insert(ExpandedR);
472     ValidRegions.erase(CurrentRegion);
473 
474     for (Region::iterator I = ExpandedR->begin(), E = ExpandedR->end(); I != E;
475          ++I)
476       ValidRegions.erase(*I);
477   }
478 }
479 
480 bool ScopDetection::allBlocksValid(DetectionContext &Context) const {
481   Region &R = Context.CurRegion;
482 
483   for (Region::block_iterator I = R.block_begin(), E = R.block_end(); I != E;
484        ++I)
485     if (!isValidBasicBlock(**I, Context))
486       return false;
487 
488   return true;
489 }
490 
491 bool ScopDetection::isValidExit(DetectionContext &Context) const {
492   Region &R = Context.CurRegion;
493 
494   // PHI nodes are not allowed in the exit basic block.
495   if (BasicBlock *Exit = R.getExit()) {
496     BasicBlock::iterator I = Exit->begin();
497     if (I != Exit->end() && isa<PHINode>(*I))
498       INVALID(Other, "PHI node in exit BB");
499   }
500 
501   return true;
502 }
503 
504 bool ScopDetection::isValidRegion(DetectionContext &Context) const {
505   Region &R = Context.CurRegion;
506 
507   DEBUG(dbgs() << "Checking region: " << R.getNameStr() << "\n\t");
508 
509   // The toplevel region is no valid region.
510   if (!R.getParent()) {
511     DEBUG(dbgs() << "Top level region is invalid";
512           dbgs() << "\n");
513     return false;
514   }
515 
516   // SCoP cannot contain the entry block of the function, because we need
517   // to insert alloca instruction there when translate scalar to array.
518   if (R.getEntry() == &(R.getEntry()->getParent()->getEntryBlock()))
519     INVALID(Other, "Region containing entry block of function is invalid!");
520 
521   // Only a simple region is allowed.
522   if (!R.isSimple())
523     INVALID(SimpleRegion, "Region not simple: " << R.getNameStr());
524 
525   if (!isValidExit(Context))
526     return false;
527 
528   if (!allBlocksValid(Context))
529     return false;
530 
531   DEBUG(dbgs() << "OK\n");
532   return true;
533 }
534 
535 bool ScopDetection::isValidFunction(llvm::Function &F) {
536   return !InvalidFunctions.count(&F);
537 }
538 
539 void ScopDetection::getDebugLocation(const Region *R, unsigned &LineBegin,
540                                      unsigned &LineEnd, std::string &FileName) {
541   LineBegin = -1;
542   LineEnd = 0;
543 
544   for (Region::const_block_iterator RI = R->block_begin(), RE = R->block_end();
545        RI != RE; ++RI)
546     for (BasicBlock::iterator BI = (*RI)->begin(), BE = (*RI)->end(); BI != BE;
547          ++BI) {
548       DebugLoc DL = BI->getDebugLoc();
549       if (DL.isUnknown())
550         continue;
551 
552       DIScope Scope(DL.getScope(BI->getContext()));
553 
554       if (FileName.empty())
555         FileName = Scope.getFilename();
556 
557       unsigned NewLine = DL.getLine();
558 
559       LineBegin = std::min(LineBegin, NewLine);
560       LineEnd = std::max(LineEnd, NewLine);
561       break;
562     }
563 }
564 
565 void ScopDetection::printLocations() {
566   for (iterator RI = begin(), RE = end(); RI != RE; ++RI) {
567     unsigned LineEntry, LineExit;
568     std::string FileName;
569 
570     getDebugLocation(*RI, LineEntry, LineExit, FileName);
571 
572     if (FileName.empty()) {
573       outs() << "Scop detected at unknown location. Compile with debug info "
574         "(-g) to get more precise information. \n";
575       return;
576     }
577 
578     outs() << FileName << ":" << LineEntry << ": Scop start\n";
579     outs() << FileName << ":" << LineExit << ": Scop end\n";
580   }
581 }
582 
583 bool ScopDetection::runOnFunction(llvm::Function &F) {
584   AA = &getAnalysis<AliasAnalysis>();
585   SE = &getAnalysis<ScalarEvolution>();
586   LI = &getAnalysis<LoopInfo>();
587   RI = &getAnalysis<RegionInfo>();
588   Region *TopRegion = RI->getTopLevelRegion();
589 
590   releaseMemory();
591 
592   if (OnlyFunction != "" && F.getName() != OnlyFunction)
593     return false;
594 
595   if (!isValidFunction(F))
596     return false;
597 
598   findScops(*TopRegion);
599 
600   if (ReportLevel >= 1)
601     printLocations();
602 
603   return false;
604 }
605 
606 void polly::ScopDetection::verifyRegion(const Region &R) const {
607   assert(isMaxRegionInScop(R) && "Expect R is a valid region.");
608   DetectionContext Context(const_cast<Region&>(R), *AA, true /*verifying*/);
609   isValidRegion(Context);
610 }
611 
612 void polly::ScopDetection::verifyAnalysis() const {
613   for (RegionSet::const_iterator I = ValidRegions.begin(),
614       E = ValidRegions.end(); I != E; ++I)
615     verifyRegion(**I);
616 }
617 
618 void ScopDetection::getAnalysisUsage(AnalysisUsage &AU) const {
619   AU.addRequired<DominatorTree>();
620   AU.addRequired<PostDominatorTree>();
621   AU.addRequired<LoopInfo>();
622   AU.addRequired<ScalarEvolution>();
623   // We also need AA and RegionInfo when we are verifying analysis.
624   AU.addRequiredTransitive<AliasAnalysis>();
625   AU.addRequiredTransitive<RegionInfo>();
626   AU.setPreservesAll();
627 }
628 
629 void ScopDetection::print(raw_ostream &OS, const Module *) const {
630   for (RegionSet::const_iterator I = ValidRegions.begin(),
631       E = ValidRegions.end(); I != E; ++I)
632     OS << "Valid Region for Scop: " << (*I)->getNameStr() << '\n';
633 
634   OS << "\n";
635 }
636 
637 void ScopDetection::releaseMemory() {
638   ValidRegions.clear();
639   InvalidRegions.clear();
640   // Do not clear the invalid function set.
641 }
642 
643 char ScopDetection::ID = 0;
644 
645 INITIALIZE_PASS_BEGIN(ScopDetection, "polly-detect",
646                       "Polly - Detect static control parts (SCoPs)", false,
647                       false)
648 INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
649 INITIALIZE_PASS_DEPENDENCY(DominatorTree)
650 INITIALIZE_PASS_DEPENDENCY(LoopInfo)
651 INITIALIZE_PASS_DEPENDENCY(PostDominatorTree)
652 INITIALIZE_PASS_DEPENDENCY(RegionInfo)
653 INITIALIZE_PASS_DEPENDENCY(ScalarEvolution)
654 INITIALIZE_PASS_END(ScopDetection, "polly-detect",
655                     "Polly - Detect static control parts (SCoPs)", false, false)
656 
657 Pass *polly::createScopDetectionPass() {
658   return new ScopDetection();
659 }
660