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/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, DetectionContext &Context) const
157 {
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: "
177                      + BB.getName());
178 
179   // Only Constant and ICmpInst are allowed as condition.
180   if (!(isa<Constant>(Condition) || isa<ICmpInst>(Condition)))
181     INVALID(AffFunc, "Condition in BB '" + BB.getName() + "' neither "
182                      "constant nor an icmp instruction");
183 
184   // Allow perfectly nested conditions.
185   assert(Br->getNumSuccessors() == 2 && "Unexpected number of successors");
186 
187   if (ICmpInst *ICmp = dyn_cast<ICmpInst>(Condition)) {
188     // Unsigned comparisons are not allowed. They trigger overflow problems
189     // in the code generation.
190     //
191     // TODO: This is not sufficient and just hides bugs. However it does pretty
192     // well.
193     if(ICmp->isUnsigned())
194       return false;
195 
196     // Are both operands of the ICmp affine?
197     if (isa<UndefValue>(ICmp->getOperand(0))
198         || isa<UndefValue>(ICmp->getOperand(1)))
199       INVALID(AffFunc, "undef operand in branch at BB: " + BB.getName());
200 
201     const SCEV *LHS = SE->getSCEV(ICmp->getOperand(0));
202     const SCEV *RHS = SE->getSCEV(ICmp->getOperand(1));
203 
204     if (!isAffineExpr(&Context.CurRegion, LHS, *SE) ||
205         !isAffineExpr(&Context.CurRegion, RHS, *SE))
206       INVALID(AffFunc, "Non affine branch in BB '" << BB.getName()
207                         << "' with LHS: " << *LHS << " and RHS: " << *RHS);
208   }
209 
210   // Allow loop exit conditions.
211   Loop *L = LI->getLoopFor(&BB);
212   if (L && L->getExitingBlock() == &BB)
213     return true;
214 
215   // Allow perfectly nested conditions.
216   Region *R = RI->getRegionFor(&BB);
217   if (R->getEntry() != &BB)
218     INVALID(CFG, "Not well structured condition at BB: " + BB.getName());
219 
220   return true;
221 }
222 
223 bool ScopDetection::isValidCallInst(CallInst &CI) {
224   if (CI.mayHaveSideEffects() || CI.doesNotReturn())
225     return false;
226 
227   if (CI.doesNotAccessMemory())
228     return true;
229 
230   Function *CalledFunction = CI.getCalledFunction();
231 
232   // Indirect calls are not supported.
233   if (CalledFunction == 0)
234     return false;
235 
236   // TODO: Intrinsics.
237   return false;
238 }
239 
240 bool ScopDetection::isValidMemoryAccess(Instruction &Inst,
241                                         DetectionContext &Context) const {
242   Value *Ptr = getPointerOperand(Inst);
243   const SCEV *AccessFunction = SE->getSCEV(Ptr);
244   const SCEVUnknown *BasePointer;
245   Value *BaseValue;
246 
247   BasePointer = dyn_cast<SCEVUnknown>(SE->getPointerBase(AccessFunction));
248 
249   if (!BasePointer)
250     INVALID(AffFunc, "No base pointer");
251 
252   BaseValue = BasePointer->getValue();
253 
254   if (isa<UndefValue>(BaseValue))
255     INVALID(AffFunc, "Undefined base pointer");
256 
257   AccessFunction = SE->getMinusSCEV(AccessFunction, BasePointer);
258 
259   if (!isAffineExpr(&Context.CurRegion, AccessFunction, *SE, BaseValue) && !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 
289 bool ScopDetection::hasScalarDependency(Instruction &Inst,
290                                         Region &RefRegion) const {
291   for (Instruction::use_iterator UI = Inst.use_begin(), UE = Inst.use_end();
292        UI != UE; ++UI)
293     if (Instruction *Use = dyn_cast<Instruction>(*UI))
294       if (!RefRegion.contains(Use->getParent())) {
295         // DirtyHack 1: PHINode user outside the Scop is not allow, if this
296         // PHINode is induction variable, the scalar to array transform may
297         // break it and introduce a non-indvar PHINode, which is not allow in
298         // Scop.
299         // This can be fix by:
300         // Introduce a IndependentBlockPrepare pass, which translate all
301         // PHINodes not in Scop to array.
302         // The IndependentBlockPrepare pass can also split the entry block of
303         // the function to hold the alloca instruction created by scalar to
304         // array.  and split the exit block of the Scop so the new create load
305         // instruction for escape users will not break other Scops.
306         if (isa<PHINode>(Use))
307           return true;
308       }
309 
310   return false;
311 }
312 
313 bool ScopDetection::isValidInstruction(Instruction &Inst,
314                                        DetectionContext &Context) const {
315   // Only canonical IVs are allowed.
316   if (PHINode *PN = dyn_cast<PHINode>(&Inst))
317     if (!isIndVar(PN, LI))
318       INVALID(IndVar, "Non canonical PHI node: " << Inst);
319 
320   // Scalar dependencies are not allowed.
321   if (hasScalarDependency(Inst, Context.CurRegion))
322     INVALID(Scalar, "Scalar dependency found: " << Inst);
323 
324   // We only check the call instruction but not invoke instruction.
325   if (CallInst *CI = dyn_cast<CallInst>(&Inst)) {
326     if (isValidCallInst(*CI))
327       return true;
328 
329     INVALID(FuncCall, "Call instruction: " << Inst);
330   }
331 
332   if (!Inst.mayWriteToMemory() && !Inst.mayReadFromMemory()) {
333     if (isa<AllocaInst>(Inst))
334       INVALID(Other, "Alloca instruction: " << Inst);
335 
336     return true;
337   }
338 
339   // Check the access function.
340   if (isa<LoadInst>(Inst) || isa<StoreInst>(Inst))
341     return isValidMemoryAccess(Inst, Context);
342 
343   // We do not know this instruction, therefore we assume it is invalid.
344   INVALID(Other, "Unknown instruction: " << Inst);
345 }
346 
347 bool ScopDetection::isValidBasicBlock(BasicBlock &BB,
348                                       DetectionContext &Context) const {
349   if (!isValidCFG(BB, Context))
350     return false;
351 
352   // Check all instructions, except the terminator instruction.
353   for (BasicBlock::iterator I = BB.begin(), E = --BB.end(); I != E; ++I)
354     if (!isValidInstruction(*I, Context))
355       return false;
356 
357   Loop *L = LI->getLoopFor(&BB);
358   if (L && L->getHeader() == &BB && !isValidLoop(L, Context))
359     return false;
360 
361   return true;
362 }
363 
364 bool ScopDetection::isValidLoop(Loop *L, DetectionContext &Context) const {
365   PHINode *IndVar = L->getCanonicalInductionVariable();
366   // No canonical induction variable.
367   if (!IndVar)
368     INVALID(IndVar, "No canonical IV at loop header: "
369                     << L->getHeader()->getName());
370 
371   // Is the loop count affine?
372   const SCEV *LoopCount = SE->getBackedgeTakenCount(L);
373   if (!isAffineExpr(&Context.CurRegion, LoopCount, *SE))
374     INVALID(LoopBound, "Non affine loop bound '" << *LoopCount << "' in loop: "
375                        << L->getHeader()->getName());
376 
377   return true;
378 }
379 
380 Region *ScopDetection::expandRegion(Region &R) {
381   // Initial no valid region was found (greater than R)
382   Region *LastValidRegion = NULL;
383   Region *ExpandedRegion  = R.getExpandedRegion();
384 
385   DEBUG(dbgs() << "\tExpanding " << R.getNameStr() << "\n");
386 
387   while (ExpandedRegion) {
388     DetectionContext Context(*ExpandedRegion, *AA, false /* verifying */);
389     DEBUG(dbgs() << "\t\tTrying " << ExpandedRegion->getNameStr() << "\n");
390 
391     // Check the exit first (cheap)
392     if (isValidExit(Context)) {
393       // If the exit is valid check all blocks
394       //  - if true, a valid region was found => store it + keep expanding
395       //  - if false, .tbd. => stop  (should this really end the loop?)
396       if (!allBlocksValid(Context))
397         break;
398 
399       // Delete unnecessary regions (allocated by getExpandedRegion)
400       if (LastValidRegion)
401         delete LastValidRegion;
402 
403       // Store this region, because it is the greatest valid (encountered so far)
404       LastValidRegion = ExpandedRegion;
405 
406       // Create and test the next greater region (if any)
407       ExpandedRegion = ExpandedRegion->getExpandedRegion();
408 
409     } else {
410       // Create and test the next greater region (if any)
411       Region *TmpRegion = ExpandedRegion->getExpandedRegion();
412 
413       // Delete unnecessary regions (allocated by getExpandedRegion)
414       delete ExpandedRegion;
415 
416       ExpandedRegion = TmpRegion;
417     }
418   }
419 
420   DEBUG(
421   if (LastValidRegion)
422     dbgs() << "\tto " << LastValidRegion->getNameStr() << "\n";
423   else
424     dbgs() << "\tExpanding " << R.getNameStr() << " failed\n";
425   );
426 
427   return LastValidRegion;
428 }
429 
430 
431 void ScopDetection::findScops(Region &R) {
432   DetectionContext Context(R, *AA, false /*verifying*/);
433 
434   LastFailure = "";
435 
436   if (isValidRegion(Context)) {
437     ++ValidRegion;
438     ValidRegions.insert(&R);
439     return;
440   }
441 
442   InvalidRegions[&R] = LastFailure;
443 
444   for (Region::iterator I = R.begin(), E = R.end(); I != E; ++I)
445     findScops(**I);
446 
447   // Try to expand regions.
448   //
449   // As the region tree normally only contains canonical regions, non canonical
450   // regions that form a Scop are not found. Therefore, those non canonical
451   // regions are checked by expanding the canonical ones.
452 
453   std::vector<Region*> ToExpand;
454 
455   for (Region::iterator I = R.begin(), E = R.end(); I != E; ++I)
456     ToExpand.push_back(*I);
457 
458   for (std::vector<Region*>::iterator RI = ToExpand.begin(),
459        RE = ToExpand.end(); RI != RE; ++RI) {
460     Region *CurrentRegion = *RI;
461 
462     // Skip invalid regions. Regions may become invalid, if they are element of
463     // an already expanded region.
464     if (ValidRegions.find(CurrentRegion) == ValidRegions.end())
465       continue;
466 
467     Region *ExpandedR = expandRegion(*CurrentRegion);
468 
469     if (!ExpandedR)
470       continue;
471 
472     R.addSubRegion(ExpandedR, true);
473     ValidRegions.insert(ExpandedR);
474     ValidRegions.erase(CurrentRegion);
475 
476     for (Region::iterator I = ExpandedR->begin(), E = ExpandedR->end(); I != E;
477          ++I)
478       ValidRegions.erase(*I);
479   }
480 }
481 
482 bool ScopDetection::allBlocksValid(DetectionContext &Context) const {
483   Region &R = Context.CurRegion;
484 
485   for (Region::block_iterator I = R.block_begin(), E = R.block_end(); I != E;
486        ++I)
487     if (!isValidBasicBlock(**I, Context))
488       return false;
489 
490   return true;
491 }
492 
493 bool ScopDetection::isValidExit(DetectionContext &Context) const {
494   Region &R = Context.CurRegion;
495 
496   // PHI nodes are not allowed in the exit basic block.
497   if (BasicBlock *Exit = R.getExit()) {
498     BasicBlock::iterator I = Exit->begin();
499     if (I != Exit->end() && isa<PHINode> (*I))
500       INVALID(Other, "PHI node in exit BB");
501   }
502 
503   return true;
504 }
505 
506 bool ScopDetection::isValidRegion(DetectionContext &Context) const {
507   Region &R = Context.CurRegion;
508 
509   DEBUG(dbgs() << "Checking region: " << R.getNameStr() << "\n\t");
510 
511   // The toplevel region is no valid region.
512   if (!R.getParent()) {
513     DEBUG(dbgs() << "Top level region is invalid";
514           dbgs() << "\n");
515     return false;
516   }
517 
518   // SCoP cannot contain the entry block of the function, because we need
519   // to insert alloca instruction there when translate scalar to array.
520   if (R.getEntry() == &(R.getEntry()->getParent()->getEntryBlock()))
521     INVALID(Other, "Region containing entry block of function is invalid!");
522 
523   // Only a simple region is allowed.
524   if (!R.isSimple())
525     INVALID(SimpleRegion, "Region not simple: " << R.getNameStr());
526 
527   if (!isValidExit(Context))
528     return false;
529 
530   if (!allBlocksValid(Context))
531     return false;
532 
533   DEBUG(dbgs() << "OK\n");
534   return true;
535 }
536 
537 bool ScopDetection::isValidFunction(llvm::Function &F) {
538   return !InvalidFunctions.count(&F);
539 }
540 
541 void ScopDetection::getDebugLocation(const Region *R, unsigned &LineBegin,
542                                      unsigned &LineEnd, std::string &FileName) {
543   LineBegin = -1;
544   LineEnd = 0;
545 
546   for (Region::const_block_iterator RI = R->block_begin(), RE = R->block_end();
547        RI != RE; ++RI)
548     for (BasicBlock::iterator BI = (*RI)->begin(), BE = (*RI)->end(); BI != BE;
549          ++BI) {
550       DebugLoc DL = BI->getDebugLoc();
551       if (DL.isUnknown())
552         continue;
553 
554       DIScope Scope(DL.getScope(BI->getContext()));
555 
556       if (FileName.empty())
557         FileName = Scope.getFilename();
558 
559       unsigned NewLine = DL.getLine();
560 
561       LineBegin = std::min(LineBegin, NewLine);
562       LineEnd = std::max(LineEnd, NewLine);
563       break;
564   }
565 }
566 
567 void ScopDetection::printLocations() {
568   for (iterator RI = begin(), RE = end(); RI != RE; ++RI) {
569     unsigned LineEntry, LineExit;
570     std::string FileName;
571 
572     getDebugLocation(*RI, LineEntry, LineExit, FileName);
573 
574     if (FileName.empty()) {
575       outs() << "Scop detected at unknown location. Compile with debug info "
576         "(-g) to get more precise information. \n";
577       return;
578     }
579 
580     outs() << FileName << ":" << LineEntry << ": Scop start\n";
581     outs() << FileName << ":" << LineExit << ": Scop end\n";
582   }
583 }
584 
585 bool ScopDetection::runOnFunction(llvm::Function &F) {
586   AA = &getAnalysis<AliasAnalysis>();
587   SE = &getAnalysis<ScalarEvolution>();
588   LI = &getAnalysis<LoopInfo>();
589   RI = &getAnalysis<RegionInfo>();
590   Region *TopRegion = RI->getTopLevelRegion();
591 
592   releaseMemory();
593 
594   if (OnlyFunction != "" && F.getName() != OnlyFunction)
595     return false;
596 
597   if(!isValidFunction(F))
598     return false;
599 
600   findScops(*TopRegion);
601 
602   if (ReportLevel >= 1)
603     printLocations();
604 
605   return false;
606 }
607 
608 
609 void polly::ScopDetection::verifyRegion(const Region &R) const {
610   assert(isMaxRegionInScop(R) && "Expect R is a valid region.");
611   DetectionContext Context(const_cast<Region&>(R), *AA, true /*verifying*/);
612   isValidRegion(Context);
613 }
614 
615 void polly::ScopDetection::verifyAnalysis() const {
616   for (RegionSet::const_iterator I = ValidRegions.begin(),
617       E = ValidRegions.end(); I != E; ++I)
618     verifyRegion(**I);
619 }
620 
621 void ScopDetection::getAnalysisUsage(AnalysisUsage &AU) const {
622   AU.addRequired<DominatorTree>();
623   AU.addRequired<PostDominatorTree>();
624   AU.addRequired<LoopInfo>();
625   AU.addRequired<ScalarEvolution>();
626   // We also need AA and RegionInfo when we are verifying analysis.
627   AU.addRequiredTransitive<AliasAnalysis>();
628   AU.addRequiredTransitive<RegionInfo>();
629   AU.setPreservesAll();
630 }
631 
632 void ScopDetection::print(raw_ostream &OS, const Module *) const {
633   for (RegionSet::const_iterator I = ValidRegions.begin(),
634       E = ValidRegions.end(); I != E; ++I)
635     OS << "Valid Region for Scop: " << (*I)->getNameStr() << '\n';
636 
637   OS << "\n";
638 }
639 
640 void ScopDetection::releaseMemory() {
641   ValidRegions.clear();
642   InvalidRegions.clear();
643   // Do not clear the invalid function set.
644 }
645 
646 char ScopDetection::ID = 0;
647 
648 INITIALIZE_PASS_BEGIN(ScopDetection, "polly-detect",
649                       "Polly - Detect static control parts (SCoPs)", false,
650                       false)
651 INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
652 INITIALIZE_PASS_DEPENDENCY(DominatorTree)
653 INITIALIZE_PASS_DEPENDENCY(LoopInfo)
654 INITIALIZE_PASS_DEPENDENCY(PostDominatorTree)
655 INITIALIZE_PASS_DEPENDENCY(RegionInfo)
656 INITIALIZE_PASS_DEPENDENCY(ScalarEvolution)
657 INITIALIZE_PASS_END(ScopDetection, "polly-detect",
658                     "Polly - Detect static control parts (SCoPs)", false, false)
659 
660 Pass *polly::createScopDetectionPass() {
661   return new ScopDetection();
662 }
663