1 //===- IslAst.cpp - isl code generator interface --------------------------===//
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 // The isl code generator interface takes a Scop and generates a isl_ast. This
11 // ist_ast can either be returned directly or it can be pretty printed to
12 // stdout.
13 //
14 // A typical isl_ast output looks like this:
15 //
16 // for (c2 = max(0, ceild(n + m, 2); c2 <= min(511, floord(5 * n, 3)); c2++) {
17 //   bb2(c2);
18 // }
19 //
20 //===----------------------------------------------------------------------===//
21 
22 #include "polly/CodeGen/CodeGeneration.h"
23 #include "polly/CodeGen/IslAst.h"
24 #include "polly/Dependences.h"
25 #include "polly/LinkAllPasses.h"
26 #include "polly/Options.h"
27 #include "polly/ScopInfo.h"
28 #include "polly/Support/GICHelper.h"
29 #include "llvm/Support/Debug.h"
30 
31 #include "isl/union_map.h"
32 #include "isl/list.h"
33 #include "isl/ast_build.h"
34 #include "isl/set.h"
35 #include "isl/map.h"
36 #include "isl/aff.h"
37 
38 #define DEBUG_TYPE "polly-ast"
39 
40 using namespace llvm;
41 using namespace polly;
42 
43 using IslAstUserPayload = IslAstInfo::IslAstUserPayload;
44 
45 static cl::opt<bool>
46     PollyParallel("polly-parallel",
47                   cl::desc("Generate thread parallel code (isl codegen only)"),
48                   cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
49 
50 static cl::opt<bool> PollyParallelForce(
51     "polly-parallel-force",
52     cl::desc(
53         "Force generation of thread parallel code ignoring any cost model"),
54     cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
55 
56 static cl::opt<bool> UseContext("polly-ast-use-context",
57                                 cl::desc("Use context"), cl::Hidden,
58                                 cl::init(false), cl::ZeroOrMore,
59                                 cl::cat(PollyCategory));
60 
61 static cl::opt<bool> DetectParallel("polly-ast-detect-parallel",
62                                     cl::desc("Detect parallelism"), cl::Hidden,
63                                     cl::init(false), cl::ZeroOrMore,
64                                     cl::cat(PollyCategory));
65 
66 static cl::opt<bool> NoEarlyExit(
67     "polly-no-early-exit",
68     cl::desc("Do not exit early if no benefit of the Polly version was found."),
69     cl::Hidden, cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
70 
71 namespace polly {
72 class IslAst {
73 public:
74   IslAst(Scop *Scop, Dependences &D);
75 
76   ~IslAst();
77 
78   /// Print a source code representation of the program.
79   void pprint(llvm::raw_ostream &OS);
80 
81   __isl_give isl_ast_node *getAst();
82 
83   /// @brief Get the run-time conditions for the Scop.
84   __isl_give isl_ast_expr *getRunCondition();
85 
86 private:
87   Scop *S;
88   isl_ast_node *Root;
89   isl_ast_expr *RunCondition;
90 
91   void buildRunCondition(__isl_keep isl_ast_build *Build);
92 };
93 } // End namespace polly.
94 
95 /// @brief Free an IslAstUserPayload object pointed to by @p Ptr
96 static void freeIslAstUserPayload(void *Ptr) {
97   delete ((IslAstInfo::IslAstUserPayload *)Ptr);
98 }
99 
100 IslAstInfo::IslAstUserPayload::~IslAstUserPayload() {
101   isl_ast_build_free(Build);
102   isl_pw_aff_free(MinimalDependenceDistance);
103 }
104 
105 /// @brief Temporary information used when building the ast.
106 struct AstBuildUserInfo {
107   /// @brief Construct and initialize the helper struct for AST creation.
108   AstBuildUserInfo()
109       : Deps(nullptr), InParallelFor(false), LastForNodeId(nullptr) {}
110 
111   /// @brief The dependence information used for the parallelism check.
112   Dependences *Deps;
113 
114   /// @brief Flag to indicate that we are inside a parallel for node.
115   bool InParallelFor;
116 
117   /// @brief The last iterator id created for the current SCoP.
118   isl_id *LastForNodeId;
119 };
120 
121 /// @brief Print a string @p str in a single line using @p Printer.
122 static isl_printer *printLine(__isl_take isl_printer *Printer,
123                               const std::string &str,
124                               __isl_keep isl_pw_aff *PWA = nullptr) {
125   Printer = isl_printer_start_line(Printer);
126   Printer = isl_printer_print_str(Printer, str.c_str());
127   if (PWA)
128     Printer = isl_printer_print_pw_aff(Printer, PWA);
129   return isl_printer_end_line(Printer);
130 }
131 
132 /// @brief Return all broken reductions as a string of clauses (OpenMP style).
133 static const std::string getBrokenReductionsStr(__isl_keep isl_ast_node *Node) {
134   IslAstInfo::MemoryAccessSet *BrokenReductions;
135   std::string str;
136 
137   BrokenReductions = IslAstInfo::getBrokenReductions(Node);
138   if (!BrokenReductions || BrokenReductions->empty())
139     return "";
140 
141   // Map each type of reduction to a comma separated list of the base addresses.
142   std::map<MemoryAccess::ReductionType, std::string> Clauses;
143   for (MemoryAccess *MA : *BrokenReductions)
144     if (MA->isWrite())
145       Clauses[MA->getReductionType()] +=
146           ", " + MA->getBaseAddr()->getName().str();
147 
148   // Now print the reductions sorted by type. Each type will cause a clause
149   // like:  reduction (+ : sum0, sum1, sum2)
150   for (const auto &ReductionClause : Clauses) {
151     str += " reduction (";
152     str += MemoryAccess::getReductionOperatorStr(ReductionClause.first);
153     // Remove the first two symbols (", ") to make the output look pretty.
154     str += " : " + ReductionClause.second.substr(2) + ")";
155   }
156 
157   return str;
158 }
159 
160 /// @brief Callback executed for each for node in the ast in order to print it.
161 static isl_printer *cbPrintFor(__isl_take isl_printer *Printer,
162                                __isl_take isl_ast_print_options *Options,
163                                __isl_keep isl_ast_node *Node, void *) {
164 
165   isl_pw_aff *DD = IslAstInfo::getMinimalDependenceDistance(Node);
166   const std::string BrokenReductionsStr = getBrokenReductionsStr(Node);
167   const std::string KnownParallelStr = "#pragma known-parallel";
168   const std::string DepDisPragmaStr = "#pragma minimal dependence distance: ";
169   const std::string SimdPragmaStr = "#pragma simd";
170   const std::string OmpPragmaStr = "#pragma omp parallel for";
171 
172   if (DD)
173     Printer = printLine(Printer, DepDisPragmaStr, DD);
174 
175   if (IslAstInfo::isInnermostParallel(Node))
176     Printer = printLine(Printer, SimdPragmaStr + BrokenReductionsStr);
177 
178   if (IslAstInfo::isExecutedInParallel(Node))
179     Printer = printLine(Printer, OmpPragmaStr);
180   else if (IslAstInfo::isOutermostParallel(Node))
181     Printer = printLine(Printer, KnownParallelStr + BrokenReductionsStr);
182 
183   isl_pw_aff_free(DD);
184   return isl_ast_node_for_print(Node, Printer, Options);
185 }
186 
187 /// @brief Check if the current scheduling dimension is parallel
188 ///
189 /// In case the dimension is parallel we also check if any reduction
190 /// dependences is broken when we exploit this parallelism. If so,
191 /// @p IsReductionParallel will be set to true. The reduction dependences we use
192 /// to check are actually the union of the transitive closure of the initial
193 /// reduction dependences together with their reveresal. Even though these
194 /// dependences connect all iterations with each other (thus they are cyclic)
195 /// we can perform the parallelism check as we are only interested in a zero
196 /// (or non-zero) dependence distance on the dimension in question.
197 static bool astScheduleDimIsParallel(__isl_keep isl_ast_build *Build,
198                                      Dependences *D,
199                                      IslAstUserPayload *NodeInfo) {
200   if (!D->hasValidDependences())
201     return false;
202 
203   isl_union_map *Schedule = isl_ast_build_get_schedule(Build);
204   isl_union_map *Deps = D->getDependences(
205       Dependences::TYPE_RAW | Dependences::TYPE_WAW | Dependences::TYPE_WAR);
206 
207   if (!D->isParallel(Schedule, Deps, &NodeInfo->MinimalDependenceDistance) &&
208       !isl_union_map_free(Schedule))
209     return false;
210 
211   isl_union_map *RedDeps = D->getDependences(Dependences::TYPE_TC_RED);
212   if (!D->isParallel(Schedule, RedDeps))
213     NodeInfo->IsReductionParallel = true;
214 
215   if (!NodeInfo->IsReductionParallel && !isl_union_map_free(Schedule))
216     return true;
217 
218   // Annotate reduction parallel nodes with the memory accesses which caused the
219   // reduction dependences parallel execution of the node conflicts with.
220   for (const auto &MaRedPair : D->getReductionDependences()) {
221     if (!MaRedPair.second)
222       continue;
223     RedDeps = isl_union_map_from_map(isl_map_copy(MaRedPair.second));
224     if (!D->isParallel(Schedule, RedDeps))
225       NodeInfo->BrokenReductions.insert(MaRedPair.first);
226   }
227 
228   isl_union_map_free(Schedule);
229   return true;
230 }
231 
232 // This method is executed before the construction of a for node. It creates
233 // an isl_id that is used to annotate the subsequently generated ast for nodes.
234 //
235 // In this function we also run the following analyses:
236 //
237 // - Detection of openmp parallel loops
238 //
239 static __isl_give isl_id *astBuildBeforeFor(__isl_keep isl_ast_build *Build,
240                                             void *User) {
241   AstBuildUserInfo *BuildInfo = (AstBuildUserInfo *)User;
242   IslAstUserPayload *Payload = new IslAstUserPayload();
243   isl_id *Id = isl_id_alloc(isl_ast_build_get_ctx(Build), "", Payload);
244   Id = isl_id_set_free_user(Id, freeIslAstUserPayload);
245   BuildInfo->LastForNodeId = Id;
246 
247   // Test for parallelism only if we are not already inside a parallel loop
248   if (!BuildInfo->InParallelFor)
249     BuildInfo->InParallelFor = Payload->IsOutermostParallel =
250         astScheduleDimIsParallel(Build, BuildInfo->Deps, Payload);
251 
252   return Id;
253 }
254 
255 // This method is executed after the construction of a for node.
256 //
257 // It performs the following actions:
258 //
259 // - Reset the 'InParallelFor' flag, as soon as we leave a for node,
260 //   that is marked as openmp parallel.
261 //
262 static __isl_give isl_ast_node *
263 astBuildAfterFor(__isl_take isl_ast_node *Node, __isl_keep isl_ast_build *Build,
264                  void *User) {
265   isl_id *Id = isl_ast_node_get_annotation(Node);
266   assert(Id && "Post order visit assumes annotated for nodes");
267   IslAstUserPayload *Payload = (IslAstUserPayload *)isl_id_get_user(Id);
268   assert(Payload && "Post order visit assumes annotated for nodes");
269 
270   AstBuildUserInfo *BuildInfo = (AstBuildUserInfo *)User;
271   assert(!Payload->Build && "Build environment already set");
272   Payload->Build = isl_ast_build_copy(Build);
273   Payload->IsInnermost = (Id == BuildInfo->LastForNodeId);
274 
275   // Innermost loops that are surrounded by parallel loops have not yet been
276   // tested for parallelism. Test them here to ensure we check all innermost
277   // loops for parallelism.
278   if (Payload->IsInnermost && BuildInfo->InParallelFor) {
279     if (Payload->IsOutermostParallel)
280       Payload->IsInnermostParallel = true;
281     else
282       Payload->IsInnermostParallel =
283           astScheduleDimIsParallel(Build, BuildInfo->Deps, Payload);
284   }
285   if (Payload->IsOutermostParallel)
286     BuildInfo->InParallelFor = false;
287 
288   isl_id_free(Id);
289   return Node;
290 }
291 
292 static __isl_give isl_ast_node *AtEachDomain(__isl_take isl_ast_node *Node,
293                                              __isl_keep isl_ast_build *Build,
294                                              void *User) {
295   assert(!isl_ast_node_get_annotation(Node) && "Node already annotated");
296 
297   IslAstUserPayload *Payload = new IslAstUserPayload();
298   isl_id *Id = isl_id_alloc(isl_ast_build_get_ctx(Build), "", Payload);
299   Id = isl_id_set_free_user(Id, freeIslAstUserPayload);
300 
301   Payload->Build = isl_ast_build_copy(Build);
302 
303   return isl_ast_node_set_annotation(Node, Id);
304 }
305 
306 void IslAst::buildRunCondition(__isl_keep isl_ast_build *Build) {
307   // The conditions that need to be checked at run-time for this scop are
308   // available as an isl_set in the AssumedContext. We generate code for this
309   // check as follows. First, we generate an isl_pw_aff that is 1, if a certain
310   // combination of parameter values fulfills the conditions in the assumed
311   // context, and that is 0 otherwise. We then translate this isl_pw_aff into
312   // an isl_ast_expr. At run-time this expression can be evaluated and the
313   // optimized scop can be executed conditionally according to the result of the
314   // run-time check.
315 
316   isl_aff *Zero =
317       isl_aff_zero_on_domain(isl_local_space_from_space(S->getParamSpace()));
318   isl_aff *One =
319       isl_aff_zero_on_domain(isl_local_space_from_space(S->getParamSpace()));
320 
321   One = isl_aff_add_constant_si(One, 1);
322 
323   isl_pw_aff *PwZero = isl_pw_aff_from_aff(Zero);
324   isl_pw_aff *PwOne = isl_pw_aff_from_aff(One);
325 
326   PwOne = isl_pw_aff_intersect_domain(PwOne, S->getAssumedContext());
327   PwZero = isl_pw_aff_intersect_domain(
328       PwZero, isl_set_complement(S->getAssumedContext()));
329 
330   isl_pw_aff *Cond = isl_pw_aff_union_max(PwOne, PwZero);
331 
332   RunCondition = isl_ast_build_expr_from_pw_aff(Build, Cond);
333 
334   // Create the alias checks from the minimal/maximal accesses in each alias
335   // group. This operation is by construction quadratic in the number of
336   // elements in each alias group.
337   isl_ast_expr *NonAliasGroup, *MinExpr, *MaxExpr;
338   for (const Scop::MinMaxVectorTy *MinMaxAccesses : S->getAliasGroups()) {
339     auto AccEnd = MinMaxAccesses->end();
340     for (auto AccIt0 = MinMaxAccesses->begin(); AccIt0 != AccEnd; ++AccIt0) {
341       for (auto AccIt1 = AccIt0 + 1; AccIt1 != AccEnd; ++AccIt1) {
342         MinExpr =
343             isl_ast_expr_address_of(isl_ast_build_access_from_pw_multi_aff(
344                 Build, isl_pw_multi_aff_copy(AccIt0->first)));
345         MaxExpr =
346             isl_ast_expr_address_of(isl_ast_build_access_from_pw_multi_aff(
347                 Build, isl_pw_multi_aff_copy(AccIt1->second)));
348         NonAliasGroup = isl_ast_expr_le(MaxExpr, MinExpr);
349         MinExpr =
350             isl_ast_expr_address_of(isl_ast_build_access_from_pw_multi_aff(
351                 Build, isl_pw_multi_aff_copy(AccIt1->first)));
352         MaxExpr =
353             isl_ast_expr_address_of(isl_ast_build_access_from_pw_multi_aff(
354                 Build, isl_pw_multi_aff_copy(AccIt0->second)));
355         NonAliasGroup =
356             isl_ast_expr_or(NonAliasGroup, isl_ast_expr_le(MaxExpr, MinExpr));
357         RunCondition = isl_ast_expr_and(RunCondition, NonAliasGroup);
358       }
359     }
360   }
361 }
362 
363 /// @brief Simple cost analysis for a given SCoP
364 ///
365 /// TODO: Improve this analysis and extract it to make it usable in other
366 ///       places too.
367 ///       In order to improve the cost model we could either keep track of
368 ///       performed optimizations (e.g., tiling) or compute properties on the
369 ///       original as well as optimized SCoP (e.g., #stride-one-accesses).
370 static bool benefitsFromPolly(Scop *Scop, bool PerformParallelTest) {
371 
372   // First check the user choice.
373   if (NoEarlyExit)
374     return true;
375 
376   // Check if nothing interesting happened.
377   if (!PerformParallelTest && !Scop->isOptimized() &&
378       Scop->getAliasGroups().empty())
379     return false;
380 
381   // The default assumption is that Polly improves the code.
382   return true;
383 }
384 
385 IslAst::IslAst(Scop *Scop, Dependences &D)
386     : S(Scop), Root(nullptr), RunCondition(nullptr) {
387 
388   bool PerformParallelTest = PollyParallel || DetectParallel ||
389                              PollyVectorizerChoice != VECTORIZER_NONE;
390 
391   // Skip AST and code generation if there was no benefit achieved.
392   if (!benefitsFromPolly(Scop, PerformParallelTest))
393     return;
394 
395   isl_ctx *Ctx = S->getIslCtx();
396   isl_options_set_ast_build_atomic_upper_bound(Ctx, true);
397   isl_ast_build *Build;
398   AstBuildUserInfo BuildInfo;
399 
400   if (UseContext)
401     Build = isl_ast_build_from_context(S->getContext());
402   else
403     Build = isl_ast_build_from_context(isl_set_universe(S->getParamSpace()));
404 
405   Build = isl_ast_build_set_at_each_domain(Build, AtEachDomain, nullptr);
406 
407   isl_union_map *Schedule =
408       isl_union_map_intersect_domain(S->getSchedule(), S->getDomains());
409 
410   if (PerformParallelTest) {
411     BuildInfo.Deps = &D;
412     BuildInfo.InParallelFor = 0;
413 
414     Build = isl_ast_build_set_before_each_for(Build, &astBuildBeforeFor,
415                                               &BuildInfo);
416     Build =
417         isl_ast_build_set_after_each_for(Build, &astBuildAfterFor, &BuildInfo);
418   }
419 
420   buildRunCondition(Build);
421 
422   Root = isl_ast_build_ast_from_schedule(Build, Schedule);
423 
424   isl_ast_build_free(Build);
425 }
426 
427 IslAst::~IslAst() {
428   isl_ast_node_free(Root);
429   isl_ast_expr_free(RunCondition);
430 }
431 
432 __isl_give isl_ast_node *IslAst::getAst() { return isl_ast_node_copy(Root); }
433 __isl_give isl_ast_expr *IslAst::getRunCondition() {
434   return isl_ast_expr_copy(RunCondition);
435 }
436 
437 void IslAstInfo::releaseMemory() {
438   if (Ast) {
439     delete Ast;
440     Ast = nullptr;
441   }
442 }
443 
444 bool IslAstInfo::runOnScop(Scop &Scop) {
445   if (Ast)
446     delete Ast;
447 
448   S = &Scop;
449 
450   Dependences &D = getAnalysis<Dependences>();
451 
452   Ast = new IslAst(&Scop, D);
453 
454   DEBUG(printScop(dbgs()));
455   return false;
456 }
457 
458 __isl_give isl_ast_node *IslAstInfo::getAst() const { return Ast->getAst(); }
459 __isl_give isl_ast_expr *IslAstInfo::getRunCondition() const {
460   return Ast->getRunCondition();
461 }
462 
463 IslAstUserPayload *IslAstInfo::getNodePayload(__isl_keep isl_ast_node *Node) {
464   isl_id *Id = isl_ast_node_get_annotation(Node);
465   if (!Id)
466     return nullptr;
467   IslAstUserPayload *Payload = (IslAstUserPayload *)isl_id_get_user(Id);
468   isl_id_free(Id);
469   return Payload;
470 }
471 
472 bool IslAstInfo::isInnermost(__isl_keep isl_ast_node *Node) {
473   IslAstUserPayload *Payload = getNodePayload(Node);
474   return Payload && Payload->IsInnermost;
475 }
476 
477 bool IslAstInfo::isParallel(__isl_keep isl_ast_node *Node) {
478   return IslAstInfo::isInnermostParallel(Node) ||
479          IslAstInfo::isOutermostParallel(Node);
480 }
481 
482 bool IslAstInfo::isInnermostParallel(__isl_keep isl_ast_node *Node) {
483   IslAstUserPayload *Payload = getNodePayload(Node);
484   return Payload && Payload->IsInnermostParallel;
485 }
486 
487 bool IslAstInfo::isOutermostParallel(__isl_keep isl_ast_node *Node) {
488   IslAstUserPayload *Payload = getNodePayload(Node);
489   return Payload && Payload->IsOutermostParallel;
490 }
491 
492 bool IslAstInfo::isReductionParallel(__isl_keep isl_ast_node *Node) {
493   IslAstUserPayload *Payload = getNodePayload(Node);
494   return Payload && Payload->IsReductionParallel;
495 }
496 
497 bool IslAstInfo::isExecutedInParallel(__isl_keep isl_ast_node *Node) {
498 
499   if (!PollyParallel)
500     return false;
501 
502   // Do not parallelize innermost loops.
503   //
504   // Parallelizing innermost loops is often not profitable, especially if
505   // they have a low number of iterations.
506   //
507   // TODO: Decide this based on the number of loop iterations that will be
508   //       executed. This can possibly require run-time checks, which again
509   //       raises the question of both run-time check overhead and code size
510   //       costs.
511   if (!PollyParallelForce && isInnermost(Node))
512     return false;
513 
514   return isOutermostParallel(Node) && !isReductionParallel(Node);
515 }
516 
517 isl_union_map *IslAstInfo::getSchedule(__isl_keep isl_ast_node *Node) {
518   IslAstUserPayload *Payload = getNodePayload(Node);
519   return Payload ? isl_ast_build_get_schedule(Payload->Build) : nullptr;
520 }
521 
522 isl_pw_aff *
523 IslAstInfo::getMinimalDependenceDistance(__isl_keep isl_ast_node *Node) {
524   IslAstUserPayload *Payload = getNodePayload(Node);
525   return Payload ? isl_pw_aff_copy(Payload->MinimalDependenceDistance)
526                  : nullptr;
527 }
528 
529 IslAstInfo::MemoryAccessSet *
530 IslAstInfo::getBrokenReductions(__isl_keep isl_ast_node *Node) {
531   IslAstUserPayload *Payload = getNodePayload(Node);
532   return Payload ? &Payload->BrokenReductions : nullptr;
533 }
534 
535 isl_ast_build *IslAstInfo::getBuild(__isl_keep isl_ast_node *Node) {
536   IslAstUserPayload *Payload = getNodePayload(Node);
537   return Payload ? Payload->Build : nullptr;
538 }
539 
540 void IslAstInfo::printScop(raw_ostream &OS) const {
541   isl_ast_print_options *Options;
542   isl_ast_node *RootNode = getAst();
543   Scop &S = getCurScop();
544   Function *F = S.getRegion().getEntry()->getParent();
545 
546   OS << ":: isl ast :: " << F->getName() << " :: " << S.getRegion().getNameStr()
547      << "\n";
548 
549   if (!RootNode) {
550     OS << ":: isl ast generation and code generation was skipped!\n\n";
551     return;
552   }
553 
554   isl_ast_expr *RunCondition = getRunCondition();
555   char *RtCStr, *AstStr;
556 
557   Options = isl_ast_print_options_alloc(S.getIslCtx());
558   Options = isl_ast_print_options_set_print_for(Options, cbPrintFor, nullptr);
559 
560   isl_printer *P = isl_printer_to_str(S.getIslCtx());
561   P = isl_printer_print_ast_expr(P, RunCondition);
562   RtCStr = isl_printer_get_str(P);
563   P = isl_printer_flush(P);
564   P = isl_printer_indent(P, 4);
565   P = isl_printer_set_output_format(P, ISL_FORMAT_C);
566   P = isl_ast_node_print(RootNode, P, Options);
567   AstStr = isl_printer_get_str(P);
568 
569   isl_union_map *Schedule =
570       isl_union_map_intersect_domain(S.getSchedule(), S.getDomains());
571 
572   DEBUG({
573     dbgs() << S.getContextStr() << "\n";
574     dbgs() << stringFromIslObj(Schedule);
575   });
576   OS << "\nif (" << RtCStr << ")\n\n";
577   OS << AstStr << "\n";
578   OS << "else\n";
579   OS << "    {  /* original code */ }\n\n";
580 
581   isl_ast_expr_free(RunCondition);
582   isl_union_map_free(Schedule);
583   isl_ast_node_free(RootNode);
584   isl_printer_free(P);
585 }
586 
587 void IslAstInfo::getAnalysisUsage(AnalysisUsage &AU) const {
588   // Get the Common analysis usage of ScopPasses.
589   ScopPass::getAnalysisUsage(AU);
590   AU.addRequired<ScopInfo>();
591   AU.addRequired<Dependences>();
592 }
593 
594 char IslAstInfo::ID = 0;
595 
596 Pass *polly::createIslAstInfoPass() { return new IslAstInfo(); }
597 
598 INITIALIZE_PASS_BEGIN(IslAstInfo, "polly-ast",
599                       "Polly - Generate an AST of the SCoP (isl)", false,
600                       false);
601 INITIALIZE_PASS_DEPENDENCY(ScopInfo);
602 INITIALIZE_PASS_DEPENDENCY(Dependences);
603 INITIALIZE_PASS_END(IslAstInfo, "polly-ast",
604                     "Polly - Generate an AST from the SCoP (isl)", false, false)
605