blob: 2e6bc31285cd85fed8f156159215bc3015a68d04 [file] [log] [blame]
Tobias Grosser75805372011-04-29 06:27:02 +00001//===----- 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
Tobias Grosserecfe21b2013-03-20 18:03:18 +000047#include "polly/CodeGen/BlockGenerators.h"
Tobias Grosser75805372011-04-29 06:27:02 +000048#include "polly/LinkAllPasses.h"
Tobias Grosser637bd632013-05-07 07:31:10 +000049#include "polly/Options.h"
Tobias Grosserecfe21b2013-03-20 18:03:18 +000050#include "polly/ScopDetection.h"
Tobias Grosser120db6b2011-11-07 12:58:54 +000051#include "polly/Support/SCEVValidator.h"
Tobias Grosser83628182013-05-07 08:11:54 +000052#include "polly/Support/ScopHelper.h"
Tobias Grosser75805372011-04-29 06:27:02 +000053#include "llvm/ADT/Statistic.h"
54#include "llvm/Analysis/AliasAnalysis.h"
Tobias Grosser6e9f25a2011-11-09 22:35:00 +000055#include "llvm/Analysis/LoopInfo.h"
Tobias Grosser75805372011-04-29 06:27:02 +000056#include "llvm/Analysis/RegionIterator.h"
Tobias Grosser6e9f25a2011-11-09 22:35:00 +000057#include "llvm/Analysis/ScalarEvolution.h"
Tobias Grosserb8710b52011-11-10 12:44:50 +000058#include "llvm/Analysis/ScalarEvolutionExpressions.h"
Tobias Grosser83628182013-05-07 08:11:54 +000059#include "llvm/DebugInfo.h"
60#include "llvm/IR/LLVMContext.h"
Tobias Grosser8519f892013-12-18 10:49:53 +000061#include "llvm/IR/DiagnosticInfo.h"
62#include "llvm/IR/DiagnosticPrinter.h"
Tobias Grosser75805372011-04-29 06:27:02 +000063
64#define DEBUG_TYPE "polly-detect"
65#include "llvm/Support/Debug.h"
66
Tobias Grosser60b54f12011-11-08 15:41:28 +000067#include <set>
68
Tobias Grosser75805372011-04-29 06:27:02 +000069using namespace llvm;
70using namespace polly;
71
Sebastian Pop8fe6d112013-05-30 17:47:32 +000072static cl::opt<bool>
73DetectScopsWithoutLoops("polly-detect-scops-in-functions-without-loops",
74 cl::desc("Detect scops in functions without loops"),
75 cl::Hidden, cl::init(false), cl::cat(PollyCategory));
76
Sebastian Pop2c9ec2e2013-06-03 16:35:37 +000077static cl::opt<bool>
78DetectRegionsWithoutLoops("polly-detect-scops-in-regions-without-loops",
79 cl::desc("Detect scops in regions without loops"),
80 cl::Hidden, cl::init(false), cl::cat(PollyCategory));
81
Tobias Grosser2ff87232011-10-23 11:17:06 +000082static cl::opt<std::string>
Tobias Grosser637bd632013-05-07 07:31:10 +000083OnlyFunction("polly-only-func", cl::desc("Only run on a single function"),
84 cl::value_desc("function-name"), cl::ValueRequired, cl::init(""),
85 cl::cat(PollyCategory));
Tobias Grosser2ff87232011-10-23 11:17:06 +000086
Tobias Grosser4449e522014-01-27 14:24:53 +000087static cl::opt<std::string>
88OnlyRegion("polly-only-region",
89 cl::desc("Only run on certain regions (The provided identifier must "
90 "appear in the name of the region's entry block"),
91 cl::value_desc("identifier"), cl::ValueRequired, cl::init(""),
92 cl::cat(PollyCategory));
93
Tobias Grosser60cd9322011-11-10 12:47:26 +000094static cl::opt<bool>
95IgnoreAliasing("polly-ignore-aliasing",
96 cl::desc("Ignore possible aliasing of the array bases"),
Tobias Grosser637bd632013-05-07 07:31:10 +000097 cl::Hidden, cl::init(false), cl::cat(PollyCategory));
Tobias Grosser2ff87232011-10-23 11:17:06 +000098
Tobias Grosser637bd632013-05-07 07:31:10 +000099static cl::opt<bool>
100ReportLevel("polly-report",
101 cl::desc("Print information about the activities of Polly"),
102 cl::init(false), cl::cat(PollyCategory));
Tobias Grosser531891e2012-11-01 16:45:20 +0000103
104static cl::opt<bool>
Tobias Grossera1879642011-12-20 10:43:14 +0000105AllowNonAffine("polly-allow-nonaffine",
106 cl::desc("Allow non affine access functions in arrays"),
Tobias Grosser637bd632013-05-07 07:31:10 +0000107 cl::Hidden, cl::init(false), cl::cat(PollyCategory));
Tobias Grossera1879642011-12-20 10:43:14 +0000108
Tobias Grosserc7d3fc52013-07-25 03:02:29 +0000109static cl::opt<bool, true>
110TrackFailures("polly-detect-track-failures",
111 cl::desc("Track failure strings in detecting scop regions"),
112 cl::location(PollyTrackFailures), cl::Hidden, cl::init(false),
113 cl::cat(PollyCategory));
114
115bool polly::PollyTrackFailures = false;
116
Tobias Grosser75805372011-04-29 06:27:02 +0000117//===----------------------------------------------------------------------===//
118// Statistics.
119
120STATISTIC(ValidRegion, "Number of regions that a valid part of Scop");
121
Tobias Grosser74394f02013-01-14 22:40:23 +0000122#define BADSCOP_STAT(NAME, DESC) \
123 STATISTIC(Bad##NAME##ForScop, "Number of bad regions for Scop: " DESC)
Tobias Grosser75805372011-04-29 06:27:02 +0000124
Tobias Grosser74394f02013-01-14 22:40:23 +0000125#define INVALID(NAME, MESSAGE) \
126 do { \
Tobias Grosserc7d3fc52013-07-25 03:02:29 +0000127 if (PollyTrackFailures) { \
128 std::string Buf; \
129 raw_string_ostream fmt(Buf); \
130 fmt << MESSAGE; \
131 fmt.flush(); \
132 LastFailure = Buf; \
133 } \
Tobias Grosser74394f02013-01-14 22:40:23 +0000134 DEBUG(dbgs() << MESSAGE); \
135 DEBUG(dbgs() << "\n"); \
Tobias Grosser1c84d802013-11-16 01:07:06 +0000136 assert(!Context.Verifying && #NAME); \
Tobias Grosser74394f02013-01-14 22:40:23 +0000137 if (!Context.Verifying) \
138 ++Bad##NAME##ForScop; \
Tobias Grosser84b81de2013-03-19 21:44:07 +0000139 } while (0)
Tobias Grosserfff5adc2011-11-10 13:21:43 +0000140
Tobias Grosser74394f02013-01-14 22:40:23 +0000141#define INVALID_NOVERIFY(NAME, MESSAGE) \
142 do { \
Tobias Grosserc7d3fc52013-07-25 03:02:29 +0000143 if (PollyTrackFailures) { \
144 std::string Buf; \
145 raw_string_ostream fmt(Buf); \
146 fmt << MESSAGE; \
147 fmt.flush(); \
148 LastFailure = Buf; \
149 } \
Tobias Grosser74394f02013-01-14 22:40:23 +0000150 DEBUG(dbgs() << MESSAGE); \
151 DEBUG(dbgs() << "\n"); \
152 /* DISABLED: assert(!Context.Verifying && #NAME); */ \
153 if (!Context.Verifying) \
154 ++Bad##NAME##ForScop; \
Tobias Grosser84b81de2013-03-19 21:44:07 +0000155 } while (0)
Tobias Grosserc4a0bd12011-10-08 00:30:48 +0000156
Tobias Grosser74394f02013-01-14 22:40:23 +0000157BADSCOP_STAT(CFG, "CFG too complex");
158BADSCOP_STAT(IndVar, "Non canonical induction variable in loop");
Sebastian Pop9d632342013-06-11 22:20:40 +0000159BADSCOP_STAT(IndEdge, "Found invalid region entering edges");
Tobias Grosser74394f02013-01-14 22:40:23 +0000160BADSCOP_STAT(LoopBound, "Loop bounds can not be computed");
161BADSCOP_STAT(FuncCall, "Function call with side effects appeared");
162BADSCOP_STAT(AffFunc, "Expression not affine");
Tobias Grosser74394f02013-01-14 22:40:23 +0000163BADSCOP_STAT(Alias, "Found base address alias");
Tobias Grosser8edce4e2013-04-16 08:04:42 +0000164BADSCOP_STAT(SimpleLoop, "Loop not in -loop-simplify form");
Tobias Grosser74394f02013-01-14 22:40:23 +0000165BADSCOP_STAT(Other, "Others");
Tobias Grosser75805372011-04-29 06:27:02 +0000166
Tobias Grosser8519f892013-12-18 10:49:53 +0000167class DiagnosticScopFound : public DiagnosticInfo {
168private:
169 static int PluginDiagnosticKind;
170
171 Function &F;
172 std::string FileName;
173 unsigned EntryLine, ExitLine;
174
175public:
Tobias Grosser1b12f462013-12-18 11:14:36 +0000176 DiagnosticScopFound(Function &F, std::string FileName, unsigned EntryLine,
177 unsigned ExitLine)
Tobias Grosser8519f892013-12-18 10:49:53 +0000178 : DiagnosticInfo(PluginDiagnosticKind, DS_Note), F(F), FileName(FileName),
Tobias Grosser1b12f462013-12-18 11:14:36 +0000179 EntryLine(EntryLine), ExitLine(ExitLine) {}
Tobias Grosser8519f892013-12-18 10:49:53 +0000180
181 virtual void print(DiagnosticPrinter &DP) const;
182
183 static bool classof(const DiagnosticInfo *DI) {
184 return DI->getKind() == PluginDiagnosticKind;
185 }
186};
187
188int DiagnosticScopFound::PluginDiagnosticKind = 10;
189
Tobias Grosser8519f892013-12-18 10:49:53 +0000190void DiagnosticScopFound::print(DiagnosticPrinter &DP) const {
191
Tobias Grosser1b12f462013-12-18 11:14:36 +0000192 DP << "Polly detected an optimizable loop region (scop) in function '" << F
193 << "'\n";
Tobias Grosser8519f892013-12-18 10:49:53 +0000194
195 if (FileName.empty()) {
196 DP << "Scop location is unknown. Compile with debug info "
197 "(-g) to get more precise information. ";
Tobias Grosser1b12f462013-12-18 11:14:36 +0000198 return;
Tobias Grosser8519f892013-12-18 10:49:53 +0000199 }
200
201 DP << FileName << ":" << EntryLine << ": Start of scop\n";
202 DP << FileName << ":" << ExitLine << ": End of scop";
203}
204
Tobias Grosser75805372011-04-29 06:27:02 +0000205//===----------------------------------------------------------------------===//
206// ScopDetection.
Tobias Grosser75805372011-04-29 06:27:02 +0000207bool ScopDetection::isMaxRegionInScop(const Region &R) const {
208 // The Region is valid only if it could be found in the set.
209 return ValidRegions.count(&R);
210}
211
Tobias Grosser4f129a62011-10-08 00:30:55 +0000212std::string ScopDetection::regionIsInvalidBecause(const Region *R) const {
213 if (!InvalidRegions.count(R))
214 return "";
215
216 return InvalidRegions.find(R)->second;
217}
218
Tobias Grossere602a072013-05-07 07:30:56 +0000219bool ScopDetection::isValidCFG(BasicBlock &BB,
220 DetectionContext &Context) const {
Tobias Grosser75805372011-04-29 06:27:02 +0000221 Region &RefRegion = Context.CurRegion;
222 TerminatorInst *TI = BB.getTerminator();
223
224 // Return instructions are only valid if the region is the top level region.
225 if (isa<ReturnInst>(TI) && !RefRegion.getExit() && TI->getNumOperands() == 0)
226 return true;
227
228 BranchInst *Br = dyn_cast<BranchInst>(TI);
229
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000230 if (!Br) {
Tobias Grosser29ee0b12011-11-17 14:52:36 +0000231 INVALID(CFG, "Non branch instruction terminates BB: " + BB.getName());
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000232 return false;
233 }
Tobias Grosser75805372011-04-29 06:27:02 +0000234
Tobias Grosser74394f02013-01-14 22:40:23 +0000235 if (Br->isUnconditional())
236 return true;
Tobias Grosser75805372011-04-29 06:27:02 +0000237
238 Value *Condition = Br->getCondition();
239
240 // UndefValue is not allowed as condition.
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000241 if (isa<UndefValue>(Condition)) {
Tobias Grosser1bb59b02012-12-29 23:47:38 +0000242 INVALID(AffFunc, "Condition based on 'undef' value in BB: " + BB.getName());
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000243 return false;
244 }
Tobias Grosser75805372011-04-29 06:27:02 +0000245
246 // Only Constant and ICmpInst are allowed as condition.
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000247 if (!(isa<Constant>(Condition) || isa<ICmpInst>(Condition))) {
Tobias Grosser4d96c8d2013-03-23 01:05:07 +0000248 INVALID(AffFunc, "Condition in BB '" + BB.getName() +
Tobias Grosserd7e58642013-04-10 06:55:45 +0000249 "' neither constant nor an icmp instruction");
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000250 return false;
251 }
Tobias Grosser75805372011-04-29 06:27:02 +0000252
253 // Allow perfectly nested conditions.
254 assert(Br->getNumSuccessors() == 2 && "Unexpected number of successors");
255
256 if (ICmpInst *ICmp = dyn_cast<ICmpInst>(Condition)) {
257 // Unsigned comparisons are not allowed. They trigger overflow problems
258 // in the code generation.
259 //
260 // TODO: This is not sufficient and just hides bugs. However it does pretty
261 // well.
Tobias Grosser1bb59b02012-12-29 23:47:38 +0000262 if (ICmp->isUnsigned())
Tobias Grosser75805372011-04-29 06:27:02 +0000263 return false;
264
265 // Are both operands of the ICmp affine?
Tobias Grosser74394f02013-01-14 22:40:23 +0000266 if (isa<UndefValue>(ICmp->getOperand(0)) ||
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000267 isa<UndefValue>(ICmp->getOperand(1))) {
Tobias Grosser29ee0b12011-11-17 14:52:36 +0000268 INVALID(AffFunc, "undef operand in branch at BB: " + BB.getName());
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000269 return false;
270 }
Tobias Grosser75805372011-04-29 06:27:02 +0000271
Sebastian Pop9f57c5b2013-04-10 04:05:18 +0000272 Loop *L = LI->getLoopFor(ICmp->getParent());
273 const SCEV *LHS = SE->getSCEVAtScope(ICmp->getOperand(0), L);
274 const SCEV *RHS = SE->getSCEVAtScope(ICmp->getOperand(1), L);
Tobias Grosser75805372011-04-29 06:27:02 +0000275
Tobias Grossera66fa6c2011-11-10 12:45:11 +0000276 if (!isAffineExpr(&Context.CurRegion, LHS, *SE) ||
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000277 !isAffineExpr(&Context.CurRegion, RHS, *SE)) {
Tobias Grosser983e7852013-07-28 09:05:20 +0000278 INVALID(AffFunc, "Non affine branch in BB '" << BB.getName()
279 << "' with LHS: " << *LHS
280 << " and RHS: " << *RHS);
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000281 return false;
282 }
Tobias Grosser75805372011-04-29 06:27:02 +0000283 }
284
285 // Allow loop exit conditions.
286 Loop *L = LI->getLoopFor(&BB);
287 if (L && L->getExitingBlock() == &BB)
288 return true;
289
290 // Allow perfectly nested conditions.
291 Region *R = RI->getRegionFor(&BB);
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000292 if (R->getEntry() != &BB) {
Tobias Grosser29ee0b12011-11-17 14:52:36 +0000293 INVALID(CFG, "Not well structured condition at BB: " + BB.getName());
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000294 return false;
295 }
Tobias Grosser75805372011-04-29 06:27:02 +0000296
297 return true;
298}
299
300bool ScopDetection::isValidCallInst(CallInst &CI) {
301 if (CI.mayHaveSideEffects() || CI.doesNotReturn())
302 return false;
303
304 if (CI.doesNotAccessMemory())
305 return true;
306
307 Function *CalledFunction = CI.getCalledFunction();
308
309 // Indirect calls are not supported.
310 if (CalledFunction == 0)
311 return false;
312
313 // TODO: Intrinsics.
314 return false;
315}
316
Tobias Grosserc7d3fc52013-07-25 03:02:29 +0000317std::string ScopDetection::formatInvalidAlias(AliasSet &AS) const {
318 std::string Message;
319 raw_string_ostream OS(Message);
320
321 OS << "Possible aliasing: ";
322
323 std::vector<Value *> Pointers;
324
325 for (AliasSet::iterator AI = AS.begin(), AE = AS.end(); AI != AE; ++AI)
326 Pointers.push_back(AI.getPointer());
327
328 std::sort(Pointers.begin(), Pointers.end());
329
330 for (std::vector<Value *>::iterator PI = Pointers.begin(),
331 PE = Pointers.end();
332 ;) {
333 Value *V = *PI;
334
335 if (V->getName().size() == 0)
336 OS << "\"" << *V << "\"";
337 else
338 OS << "\"" << V->getName() << "\"";
339
340 ++PI;
341
342 if (PI != PE)
343 OS << ", ";
344 else
345 break;
346 }
347
348 return OS.str();
349}
350
Tobias Grosser458fb782014-01-28 12:58:58 +0000351bool ScopDetection::isInvariant(const Value &Val, const Region &Reg) const {
352 // A reference to function argument or constant value is invariant.
353 if (isa<Argument>(Val) || isa<Constant>(Val))
354 return true;
355
356 const Instruction *I = dyn_cast<Instruction>(&Val);
357 if (!I)
358 return false;
359
360 if (!Reg.contains(I))
361 return true;
362
363 if (I->mayHaveSideEffects())
364 return false;
365
366 // When Val is a Phi node, it is likely not invariant. We do not check whether
367 // Phi nodes are actually invariant, we assume that Phi nodes are usually not
368 // invariant. Recursively checking the operators of Phi nodes would lead to
369 // infinite recursion.
370 if (isa<PHINode>(*I))
371 return false;
372
373 // Check that all operands of the instruction are
374 // themselves invariant.
375 const Instruction::const_op_iterator OE = I->op_end();
376 for (Instruction::const_op_iterator OI = I->op_begin(); OI != OE; ++OI) {
377 if (!isInvariant(**OI, Reg))
378 return false;
379 }
380
381 // When the instruction is a load instruction, check that no write to memory
382 // in the region aliases with the load.
383 if (const LoadInst *LI = dyn_cast<LoadInst>(I)) {
384 AliasAnalysis::Location Loc = AA->getLocation(LI);
385 const Region::const_block_iterator BE = Reg.block_end();
386 // Check if any basic block in the region can modify the location pointed to
387 // by 'Loc'. If so, 'Val' is (likely) not invariant in the region.
388 for (Region::const_block_iterator BI = Reg.block_begin(); BI != BE; ++BI) {
389 const BasicBlock &BB = **BI;
390 if (AA->canBasicBlockModify(BB, Loc))
391 return false;
392 }
393 }
394
395 return true;
396}
397
Tobias Grosser75805372011-04-29 06:27:02 +0000398bool ScopDetection::isValidMemoryAccess(Instruction &Inst,
399 DetectionContext &Context) const {
Tobias Grossere5e171e2011-11-10 12:45:03 +0000400 Value *Ptr = getPointerOperand(Inst);
Sebastian Pop9f57c5b2013-04-10 04:05:18 +0000401 Loop *L = LI->getLoopFor(Inst.getParent());
402 const SCEV *AccessFunction = SE->getSCEVAtScope(Ptr, L);
Tobias Grosserb8710b52011-11-10 12:44:50 +0000403 const SCEVUnknown *BasePointer;
Tobias Grossere5e171e2011-11-10 12:45:03 +0000404 Value *BaseValue;
Tobias Grosser75805372011-04-29 06:27:02 +0000405
Tobias Grosserb8710b52011-11-10 12:44:50 +0000406 BasePointer = dyn_cast<SCEVUnknown>(SE->getPointerBase(AccessFunction));
407
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000408 if (!BasePointer) {
Tobias Grosserb8710b52011-11-10 12:44:50 +0000409 INVALID(AffFunc, "No base pointer");
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000410 return false;
411 }
Tobias Grosserb8710b52011-11-10 12:44:50 +0000412
413 BaseValue = BasePointer->getValue();
414
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000415 if (isa<UndefValue>(BaseValue)) {
Tobias Grosserb8710b52011-11-10 12:44:50 +0000416 INVALID(AffFunc, "Undefined base pointer");
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000417 return false;
418 }
Tobias Grosserb8710b52011-11-10 12:44:50 +0000419
Tobias Grosser458fb782014-01-28 12:58:58 +0000420 // Check that the base address of the access is invariant in the current
421 // region.
422 if (!isInvariant(*BaseValue, Context.CurRegion)) {
Tobias Grosserab2227a2014-01-28 13:43:24 +0000423 // Verification of this property is difficult as the independent blocks
424 // pass may introduce aliasing that we did not have when running the
425 // scop detection.
426 INVALID_NOVERIFY(
427 AffFunc, "Base address not invariant in current region:" << *BaseValue);
Tobias Grosser458fb782014-01-28 12:58:58 +0000428 return false;
429 }
430
Tobias Grosserb8710b52011-11-10 12:44:50 +0000431 AccessFunction = SE->getMinusSCEV(AccessFunction, BasePointer);
432
Tobias Grosser58032cb2013-06-23 01:29:29 +0000433 if (!AllowNonAffine &&
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000434 !isAffineExpr(&Context.CurRegion, AccessFunction, *SE, BaseValue)) {
Tobias Grossereeb776a2012-09-08 14:00:37 +0000435 INVALID(AffFunc, "Non affine access function: " << *AccessFunction);
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000436 return false;
437 }
Tobias Grosser75805372011-04-29 06:27:02 +0000438
439 // FIXME: Alias Analysis thinks IntToPtrInst aliases with alloca instructions
440 // created by IndependentBlocks Pass.
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000441 if (isa<IntToPtrInst>(BaseValue)) {
Tobias Grossere5e171e2011-11-10 12:45:03 +0000442 INVALID(Other, "Find bad intToptr prt: " << *BaseValue);
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000443 return false;
444 }
Tobias Grosser75805372011-04-29 06:27:02 +0000445
Sebastian Pop8c2d7532013-07-03 22:50:36 +0000446 if (IgnoreAliasing)
447 return true;
Tobias Grosserfff5adc2011-11-10 13:21:43 +0000448
Sebastian Pop8c2d7532013-07-03 22:50:36 +0000449 // Check if the base pointer of the memory access does alias with
450 // any other pointer. This cannot be handled at the moment.
Tobias Grosser298a7642013-07-14 18:09:43 +0000451 AliasSet &AS =
452 Context.AST.getAliasSetForPointer(BaseValue, AliasAnalysis::UnknownSize,
453 Inst.getMetadata(LLVMContext::MD_tbaa));
Tobias Grosser428b3e42013-02-04 15:46:25 +0000454
Sebastian Pop8c2d7532013-07-03 22:50:36 +0000455 // INVALID triggers an assertion in verifying mode, if it detects that a
456 // SCoP was detected by SCoP detection and that this SCoP was invalidated by
457 // a pass that stated it would preserve the SCoPs. We disable this check as
458 // the independent blocks pass may create memory references which seem to
459 // alias, if -basicaa is not available. They actually do not, but as we can
460 // not proof this without -basicaa we would fail. We disable this check to
461 // not cause irrelevant verification failures.
462 if (!AS.isMustAlias()) {
Tobias Grosserc7d3fc52013-07-25 03:02:29 +0000463 INVALID_NOVERIFY(Alias, formatInvalidAlias(AS));
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000464 return false;
Tobias Grosser428b3e42013-02-04 15:46:25 +0000465 }
Tobias Grosser75805372011-04-29 06:27:02 +0000466
467 return true;
468}
469
Tobias Grosser75805372011-04-29 06:27:02 +0000470bool ScopDetection::isValidInstruction(Instruction &Inst,
471 DetectionContext &Context) const {
Tobias Grosser75805372011-04-29 06:27:02 +0000472 if (PHINode *PN = dyn_cast<PHINode>(&Inst))
Tobias Grosserecfe21b2013-03-20 18:03:18 +0000473 if (!canSynthesize(PN, LI, SE, &Context.CurRegion)) {
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000474 if (SCEVCodegen) {
Tobias Grosserecfe21b2013-03-20 18:03:18 +0000475 INVALID(IndVar,
476 "SCEV of PHI node refers to SSA names in region: " << Inst);
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000477 return false;
478
479 } else {
Tobias Grosserecfe21b2013-03-20 18:03:18 +0000480 INVALID(IndVar, "Non canonical PHI node: " << Inst);
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000481 return false;
482 }
Tobias Grosserecfe21b2013-03-20 18:03:18 +0000483 }
Tobias Grosser75805372011-04-29 06:27:02 +0000484
Tobias Grosser75805372011-04-29 06:27:02 +0000485 // We only check the call instruction but not invoke instruction.
486 if (CallInst *CI = dyn_cast<CallInst>(&Inst)) {
487 if (isValidCallInst(*CI))
488 return true;
489
Tobias Grosserb43ba822011-10-08 00:49:30 +0000490 INVALID(FuncCall, "Call instruction: " << Inst);
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000491 return false;
Tobias Grosser75805372011-04-29 06:27:02 +0000492 }
493
494 if (!Inst.mayWriteToMemory() && !Inst.mayReadFromMemory()) {
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000495 if (!isa<AllocaInst>(Inst))
496 return true;
Tobias Grosser75805372011-04-29 06:27:02 +0000497
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000498 INVALID(Other, "Alloca instruction: " << Inst);
499 return false;
Tobias Grosser75805372011-04-29 06:27:02 +0000500 }
501
502 // Check the access function.
503 if (isa<LoadInst>(Inst) || isa<StoreInst>(Inst))
504 return isValidMemoryAccess(Inst, Context);
505
506 // We do not know this instruction, therefore we assume it is invalid.
Tobias Grosserc4a0bd12011-10-08 00:30:48 +0000507 INVALID(Other, "Unknown instruction: " << Inst);
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000508 return false;
Tobias Grosser75805372011-04-29 06:27:02 +0000509}
510
Tobias Grosser75805372011-04-29 06:27:02 +0000511bool ScopDetection::isValidLoop(Loop *L, DetectionContext &Context) const {
Tobias Grosser826b2af2013-03-21 16:14:50 +0000512 if (!SCEVCodegen) {
513 // If code generation is not in scev based mode, we need to ensure that
514 // each loop has a canonical induction variable.
515 PHINode *IndVar = L->getCanonicalInductionVariable();
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000516 if (!IndVar) {
Tobias Grosser826b2af2013-03-21 16:14:50 +0000517 INVALID(IndVar,
518 "No canonical IV at loop header: " << L->getHeader()->getName());
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000519 return false;
520 }
Tobias Grosser826b2af2013-03-21 16:14:50 +0000521 }
Tobias Grosser75805372011-04-29 06:27:02 +0000522
523 // Is the loop count affine?
524 const SCEV *LoopCount = SE->getBackedgeTakenCount(L);
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000525 if (!isAffineExpr(&Context.CurRegion, LoopCount, *SE)) {
Tobias Grosser58032cb2013-06-23 01:29:29 +0000526 INVALID(LoopBound, "Non affine loop bound '" << *LoopCount << "' in loop: "
527 << L->getHeader()->getName());
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000528 return false;
529 }
Tobias Grosser75805372011-04-29 06:27:02 +0000530
531 return true;
532}
533
534Region *ScopDetection::expandRegion(Region &R) {
Hongbin Zhenged986ab2012-04-07 15:14:28 +0000535 // Initial no valid region was found (greater than R)
536 Region *LastValidRegion = NULL;
Tobias Grosser1bb59b02012-12-29 23:47:38 +0000537 Region *ExpandedRegion = R.getExpandedRegion();
Tobias Grosser75805372011-04-29 06:27:02 +0000538
539 DEBUG(dbgs() << "\tExpanding " << R.getNameStr() << "\n");
540
Hongbin Zhenged986ab2012-04-07 15:14:28 +0000541 while (ExpandedRegion) {
542 DetectionContext Context(*ExpandedRegion, *AA, false /* verifying */);
543 DEBUG(dbgs() << "\t\tTrying " << ExpandedRegion->getNameStr() << "\n");
Tobias Grosser75805372011-04-29 06:27:02 +0000544
Hongbin Zhenged986ab2012-04-07 15:14:28 +0000545 // Check the exit first (cheap)
Tobias Grosser75805372011-04-29 06:27:02 +0000546 if (isValidExit(Context)) {
Hongbin Zhenged986ab2012-04-07 15:14:28 +0000547 // If the exit is valid check all blocks
548 // - if true, a valid region was found => store it + keep expanding
549 // - if false, .tbd. => stop (should this really end the loop?)
550 if (!allBlocksValid(Context))
551 break;
Tobias Grosser75805372011-04-29 06:27:02 +0000552
Hongbin Zhenged986ab2012-04-07 15:14:28 +0000553 // Delete unnecessary regions (allocated by getExpandedRegion)
554 if (LastValidRegion)
555 delete LastValidRegion;
556
Tobias Grosserd7e58642013-04-10 06:55:45 +0000557 // Store this region, because it is the greatest valid (encountered so
558 // far).
Hongbin Zhenged986ab2012-04-07 15:14:28 +0000559 LastValidRegion = ExpandedRegion;
560
561 // Create and test the next greater region (if any)
562 ExpandedRegion = ExpandedRegion->getExpandedRegion();
563
564 } else {
565 // Create and test the next greater region (if any)
566 Region *TmpRegion = ExpandedRegion->getExpandedRegion();
567
568 // Delete unnecessary regions (allocated by getExpandedRegion)
569 delete ExpandedRegion;
570
571 ExpandedRegion = TmpRegion;
Tobias Grosser75805372011-04-29 06:27:02 +0000572 }
Tobias Grosser75805372011-04-29 06:27:02 +0000573 }
574
Tobias Grosser378a9f22013-11-16 19:34:11 +0000575 DEBUG({
576 if (LastValidRegion)
577 dbgs() << "\tto " << LastValidRegion->getNameStr() << "\n";
578 else
579 dbgs() << "\tExpanding " << R.getNameStr() << " failed\n";
580 });
Tobias Grosser75805372011-04-29 06:27:02 +0000581
Hongbin Zhenged986ab2012-04-07 15:14:28 +0000582 return LastValidRegion;
Tobias Grosser75805372011-04-29 06:27:02 +0000583}
Sebastian Pop2c9ec2e2013-06-03 16:35:37 +0000584static bool regionWithoutLoops(Region &R, LoopInfo *LI) {
585 for (Region::block_iterator I = R.block_begin(), E = R.block_end(); I != E;
586 ++I)
587 if (R.contains(LI->getLoopFor(*I)))
588 return false;
589
590 return true;
591}
Tobias Grosser75805372011-04-29 06:27:02 +0000592
Tobias Grosser75805372011-04-29 06:27:02 +0000593void ScopDetection::findScops(Region &R) {
Sebastian Pop2c9ec2e2013-06-03 16:35:37 +0000594
595 if (!DetectRegionsWithoutLoops && regionWithoutLoops(R, LI))
596 return;
597
Tobias Grosser75805372011-04-29 06:27:02 +0000598 DetectionContext Context(R, *AA, false /*verifying*/);
599
Tobias Grosser4eb73812011-11-10 12:45:15 +0000600 LastFailure = "";
601
Tobias Grosser75805372011-04-29 06:27:02 +0000602 if (isValidRegion(Context)) {
603 ++ValidRegion;
604 ValidRegions.insert(&R);
605 return;
606 }
607
Tobias Grosser4f129a62011-10-08 00:30:55 +0000608 InvalidRegions[&R] = LastFailure;
609
Tobias Grosser75805372011-04-29 06:27:02 +0000610 for (Region::iterator I = R.begin(), E = R.end(); I != E; ++I)
611 findScops(**I);
612
613 // Try to expand regions.
614 //
615 // As the region tree normally only contains canonical regions, non canonical
616 // regions that form a Scop are not found. Therefore, those non canonical
617 // regions are checked by expanding the canonical ones.
618
Tobias Grosser0d1eee32013-02-05 11:56:05 +0000619 std::vector<Region *> ToExpand;
Tobias Grosser75805372011-04-29 06:27:02 +0000620
621 for (Region::iterator I = R.begin(), E = R.end(); I != E; ++I)
622 ToExpand.push_back(*I);
623
Tobias Grosseraf3c00b82013-02-05 09:40:22 +0000624 for (std::vector<Region *>::iterator RI = ToExpand.begin(),
625 RE = ToExpand.end();
626 RI != RE; ++RI) {
Tobias Grosser75805372011-04-29 06:27:02 +0000627 Region *CurrentRegion = *RI;
628
629 // Skip invalid regions. Regions may become invalid, if they are element of
630 // an already expanded region.
631 if (ValidRegions.find(CurrentRegion) == ValidRegions.end())
632 continue;
633
634 Region *ExpandedR = expandRegion(*CurrentRegion);
635
636 if (!ExpandedR)
637 continue;
638
639 R.addSubRegion(ExpandedR, true);
640 ValidRegions.insert(ExpandedR);
641 ValidRegions.erase(CurrentRegion);
642
643 for (Region::iterator I = ExpandedR->begin(), E = ExpandedR->end(); I != E;
644 ++I)
645 ValidRegions.erase(*I);
646 }
647}
648
649bool ScopDetection::allBlocksValid(DetectionContext &Context) const {
650 Region &R = Context.CurRegion;
651
652 for (Region::block_iterator I = R.block_begin(), E = R.block_end(); I != E;
Sebastian Popb88ea5e2013-06-11 22:20:32 +0000653 ++I) {
654 Loop *L = LI->getLoopFor(*I);
655 if (L && L->getHeader() == *I && !isValidLoop(L, Context))
656 return false;
657 }
658
659 for (Region::block_iterator I = R.block_begin(), E = R.block_end(); I != E;
Tobias Grosser75805372011-04-29 06:27:02 +0000660 ++I)
Sebastian Pop9e3d2dd2013-06-11 22:20:27 +0000661 if (!isValidCFG(**I, Context))
662 return false;
663
Sebastian Pop8ca899c2013-06-14 20:20:43 +0000664 for (Region::block_iterator BI = R.block_begin(), E = R.block_end(); BI != E;
665 ++BI)
666 for (BasicBlock::iterator I = (*BI)->begin(), E = --(*BI)->end(); I != E;
667 ++I)
668 if (!isValidInstruction(*I, Context))
669 return false;
Tobias Grosser75805372011-04-29 06:27:02 +0000670
671 return true;
672}
673
674bool ScopDetection::isValidExit(DetectionContext &Context) const {
675 Region &R = Context.CurRegion;
676
677 // PHI nodes are not allowed in the exit basic block.
678 if (BasicBlock *Exit = R.getExit()) {
679 BasicBlock::iterator I = Exit->begin();
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000680 if (I != Exit->end() && isa<PHINode>(*I)) {
Tobias Grosserc4a0bd12011-10-08 00:30:48 +0000681 INVALID(Other, "PHI node in exit BB");
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000682 return false;
683 }
Tobias Grosser75805372011-04-29 06:27:02 +0000684 }
685
686 return true;
687}
688
689bool ScopDetection::isValidRegion(DetectionContext &Context) const {
690 Region &R = Context.CurRegion;
691
692 DEBUG(dbgs() << "Checking region: " << R.getNameStr() << "\n\t");
693
Tobias Grosseraeabcf22013-04-02 06:41:48 +0000694 if (R.isTopLevelRegion()) {
Tobias Grosser4d96c8d2013-03-23 01:05:07 +0000695 DEBUG(dbgs() << "Top level region is invalid"; dbgs() << "\n");
Tobias Grosser75805372011-04-29 06:27:02 +0000696 return false;
697 }
698
Tobias Grosser4449e522014-01-27 14:24:53 +0000699 if (!R.getEntry()->getName().count(OnlyRegion)) {
700 DEBUG({
701 dbgs() << "Region entry does not match -polly-region-only";
702 dbgs() << "\n";
703 });
704 return false;
705 }
706
Tobias Grossere602a072013-05-07 07:30:56 +0000707 if (!R.getEnteringBlock()) {
Sebastian Pop9d632342013-06-11 22:20:40 +0000708 BasicBlock *entry = R.getEntry();
709 Loop *L = LI->getLoopFor(entry);
710
711 if (L) {
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000712 if (!L->isLoopSimplifyForm()) {
Sebastian Pop9d632342013-06-11 22:20:40 +0000713 INVALID(SimpleLoop, "Loop not in simplify form is invalid!");
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000714 return false;
715 }
Sebastian Pop9d632342013-06-11 22:20:40 +0000716
717 for (pred_iterator PI = pred_begin(entry), PE = pred_end(entry); PI != PE;
718 ++PI) {
719 // Region entering edges come from the same loop but outside the region
720 // are not allowed.
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000721 if (L->contains(*PI) && !R.contains(*PI)) {
Sebastian Pop9d632342013-06-11 22:20:40 +0000722 INVALID(IndEdge, "Region has invalid entering edges!");
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000723 return false;
724 }
Sebastian Pop9d632342013-06-11 22:20:40 +0000725 }
726 }
Tobias Grosser8edce4e2013-04-16 08:04:42 +0000727 }
728
Tobias Grosserd654c252012-04-10 18:12:19 +0000729 // SCoP cannot contain the entry block of the function, because we need
Tobias Grosser75805372011-04-29 06:27:02 +0000730 // to insert alloca instruction there when translate scalar to array.
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000731 if (R.getEntry() == &(R.getEntry()->getParent()->getEntryBlock())) {
Tobias Grosserc4a0bd12011-10-08 00:30:48 +0000732 INVALID(Other, "Region containing entry block of function is invalid!");
Tobias Grosser5b1a7f22013-07-22 03:50:33 +0000733 return false;
734 }
Tobias Grosser75805372011-04-29 06:27:02 +0000735
Hongbin Zheng94868e62012-04-07 12:29:17 +0000736 if (!isValidExit(Context))
Tobias Grosser75805372011-04-29 06:27:02 +0000737 return false;
738
Hongbin Zheng94868e62012-04-07 12:29:17 +0000739 if (!allBlocksValid(Context))
Tobias Grosser75805372011-04-29 06:27:02 +0000740 return false;
741
742 DEBUG(dbgs() << "OK\n");
743 return true;
744}
745
746bool ScopDetection::isValidFunction(llvm::Function &F) {
Hongbin Zheng94c5df12011-05-06 02:38:20 +0000747 return !InvalidFunctions.count(&F);
Tobias Grosser75805372011-04-29 06:27:02 +0000748}
749
Tobias Grosser531891e2012-11-01 16:45:20 +0000750void ScopDetection::getDebugLocation(const Region *R, unsigned &LineBegin,
751 unsigned &LineEnd, std::string &FileName) {
752 LineBegin = -1;
753 LineEnd = 0;
754
755 for (Region::const_block_iterator RI = R->block_begin(), RE = R->block_end();
756 RI != RE; ++RI)
757 for (BasicBlock::iterator BI = (*RI)->begin(), BE = (*RI)->end(); BI != BE;
758 ++BI) {
759 DebugLoc DL = BI->getDebugLoc();
760 if (DL.isUnknown())
761 continue;
762
763 DIScope Scope(DL.getScope(BI->getContext()));
764
765 if (FileName.empty())
766 FileName = Scope.getFilename();
767
768 unsigned NewLine = DL.getLine();
769
770 LineBegin = std::min(LineBegin, NewLine);
771 LineEnd = std::max(LineEnd, NewLine);
Tobias Grosser1bb59b02012-12-29 23:47:38 +0000772 }
Tobias Grosser531891e2012-11-01 16:45:20 +0000773}
774
Tobias Grosserb2863ca2013-03-04 19:49:51 +0000775void ScopDetection::printLocations(llvm::Function &F) {
Tobias Grosser531891e2012-11-01 16:45:20 +0000776 for (iterator RI = begin(), RE = end(); RI != RE; ++RI) {
777 unsigned LineEntry, LineExit;
778 std::string FileName;
779
780 getDebugLocation(*RI, LineEntry, LineExit, FileName);
Tobias Grosser8519f892013-12-18 10:49:53 +0000781 DiagnosticScopFound Diagnostic(F, FileName, LineEntry, LineExit);
782 F.getContext().diagnose(Diagnostic);
Tobias Grosser531891e2012-11-01 16:45:20 +0000783 }
784}
785
Tobias Grosser75805372011-04-29 06:27:02 +0000786bool ScopDetection::runOnFunction(llvm::Function &F) {
Sebastian Pop8fe6d112013-05-30 17:47:32 +0000787 LI = &getAnalysis<LoopInfo>();
Tobias Grosser9a26f292014-01-02 22:28:53 +0000788 RI = &getAnalysis<RegionInfo>();
Sebastian Pop8fe6d112013-05-30 17:47:32 +0000789 if (!DetectScopsWithoutLoops && LI->empty())
790 return false;
791
Tobias Grosser75805372011-04-29 06:27:02 +0000792 AA = &getAnalysis<AliasAnalysis>();
793 SE = &getAnalysis<ScalarEvolution>();
Tobias Grosser75805372011-04-29 06:27:02 +0000794 Region *TopRegion = RI->getTopLevelRegion();
795
Tobias Grosser2ff87232011-10-23 11:17:06 +0000796 releaseMemory();
797
Tobias Grosser29ee0b12011-11-17 14:52:36 +0000798 if (OnlyFunction != "" && F.getName() != OnlyFunction)
Tobias Grosser2ff87232011-10-23 11:17:06 +0000799 return false;
800
Tobias Grosser1bb59b02012-12-29 23:47:38 +0000801 if (!isValidFunction(F))
Tobias Grosser75805372011-04-29 06:27:02 +0000802 return false;
803
804 findScops(*TopRegion);
Tobias Grosser531891e2012-11-01 16:45:20 +0000805
806 if (ReportLevel >= 1)
Tobias Grosserb2863ca2013-03-04 19:49:51 +0000807 printLocations(F);
Tobias Grosser531891e2012-11-01 16:45:20 +0000808
Tobias Grosser75805372011-04-29 06:27:02 +0000809 return false;
810}
811
Tobias Grosser75805372011-04-29 06:27:02 +0000812void polly::ScopDetection::verifyRegion(const Region &R) const {
813 assert(isMaxRegionInScop(R) && "Expect R is a valid region.");
Tobias Grosser0d1eee32013-02-05 11:56:05 +0000814 DetectionContext Context(const_cast<Region &>(R), *AA, true /*verifying*/);
Tobias Grosser75805372011-04-29 06:27:02 +0000815 isValidRegion(Context);
816}
817
818void polly::ScopDetection::verifyAnalysis() const {
819 for (RegionSet::const_iterator I = ValidRegions.begin(),
Tobias Grosseraf3c00b82013-02-05 09:40:22 +0000820 E = ValidRegions.end();
821 I != E; ++I)
Tobias Grosser75805372011-04-29 06:27:02 +0000822 verifyRegion(**I);
823}
824
825void ScopDetection::getAnalysisUsage(AnalysisUsage &AU) const {
Tobias Grosser42aff302014-01-13 22:29:56 +0000826 AU.addRequired<DominatorTreeWrapperPass>();
Tobias Grosser75805372011-04-29 06:27:02 +0000827 AU.addRequired<PostDominatorTree>();
828 AU.addRequired<LoopInfo>();
829 AU.addRequired<ScalarEvolution>();
830 // We also need AA and RegionInfo when we are verifying analysis.
831 AU.addRequiredTransitive<AliasAnalysis>();
832 AU.addRequiredTransitive<RegionInfo>();
833 AU.setPreservesAll();
834}
835
Tobias Grosser4d96c8d2013-03-23 01:05:07 +0000836void ScopDetection::print(raw_ostream &OS, const Module *) const {
Tobias Grosser75805372011-04-29 06:27:02 +0000837 for (RegionSet::const_iterator I = ValidRegions.begin(),
Tobias Grosseraf3c00b82013-02-05 09:40:22 +0000838 E = ValidRegions.end();
839 I != E; ++I)
Tobias Grosser75805372011-04-29 06:27:02 +0000840 OS << "Valid Region for Scop: " << (*I)->getNameStr() << '\n';
841
842 OS << "\n";
843}
844
845void ScopDetection::releaseMemory() {
846 ValidRegions.clear();
Tobias Grosser4f129a62011-10-08 00:30:55 +0000847 InvalidRegions.clear();
Hongbin Zheng94c5df12011-05-06 02:38:20 +0000848 // Do not clear the invalid function set.
Tobias Grosser75805372011-04-29 06:27:02 +0000849}
850
851char ScopDetection::ID = 0;
852
Tobias Grosser4d96c8d2013-03-23 01:05:07 +0000853Pass *polly::createScopDetectionPass() { return new ScopDetection(); }
854
Tobias Grosser73600b82011-10-08 00:30:40 +0000855INITIALIZE_PASS_BEGIN(ScopDetection, "polly-detect",
856 "Polly - Detect static control parts (SCoPs)", false,
Tobias Grosser4d96c8d2013-03-23 01:05:07 +0000857 false);
858INITIALIZE_AG_DEPENDENCY(AliasAnalysis);
Tobias Grosser42aff302014-01-13 22:29:56 +0000859INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass);
Tobias Grosser4d96c8d2013-03-23 01:05:07 +0000860INITIALIZE_PASS_DEPENDENCY(LoopInfo);
861INITIALIZE_PASS_DEPENDENCY(PostDominatorTree);
862INITIALIZE_PASS_DEPENDENCY(RegionInfo);
863INITIALIZE_PASS_DEPENDENCY(ScalarEvolution);
Tobias Grosser73600b82011-10-08 00:30:40 +0000864INITIALIZE_PASS_END(ScopDetection, "polly-detect",
865 "Polly - Detect static control parts (SCoPs)", false, false)