Polly 19.0.0git
DependenceInfo.cpp
Go to the documentation of this file.
1//===- DependenceInfo.cpp - Calculate dependency information for a Scop. --===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// Calculate the data dependency relations for a Scop using ISL.
10//
11// The integer set library (ISL) from Sven, has a integrated dependency analysis
12// to calculate data dependences. This pass takes advantage of this and
13// calculate those dependences a Scop.
14//
15// The dependences in this pass are exact in terms that for a specific read
16// statement instance only the last write statement instance is returned. In
17// case of may writes a set of possible write instances is returned. This
18// analysis will never produce redundant dependences.
19//
20//===----------------------------------------------------------------------===//
21//
23#include "polly/LinkAllPasses.h"
24#include "polly/Options.h"
25#include "polly/ScopInfo.h"
28#include "llvm/ADT/Sequence.h"
29#include "llvm/Support/Debug.h"
30#include "isl/aff.h"
31#include "isl/ctx.h"
32#include "isl/flow.h"
33#include "isl/map.h"
34#include "isl/schedule.h"
35#include "isl/set.h"
36#include "isl/union_map.h"
37#include "isl/union_set.h"
38
39using namespace polly;
40using namespace llvm;
41
43#define DEBUG_TYPE "polly-dependence"
44
45static cl::opt<int> OptComputeOut(
46 "polly-dependences-computeout",
47 cl::desc("Bound the dependence analysis by a maximal amount of "
48 "computational steps (0 means no bound)"),
49 cl::Hidden, cl::init(500000), cl::cat(PollyCategory));
50
51static cl::opt<bool>
52 LegalityCheckDisabled("disable-polly-legality",
53 cl::desc("Disable polly legality check"), cl::Hidden,
54 cl::cat(PollyCategory));
55
56static cl::opt<bool>
57 UseReductions("polly-dependences-use-reductions",
58 cl::desc("Exploit reductions in dependence analysis"),
59 cl::Hidden, cl::init(true), cl::cat(PollyCategory));
60
62
63static cl::opt<enum AnalysisType> OptAnalysisType(
64 "polly-dependences-analysis-type",
65 cl::desc("The kind of dependence analysis to use"),
66 cl::values(clEnumValN(VALUE_BASED_ANALYSIS, "value-based",
67 "Exact dependences without transitive dependences"),
68 clEnumValN(MEMORY_BASED_ANALYSIS, "memory-based",
69 "Overapproximation of dependences")),
70 cl::Hidden, cl::init(VALUE_BASED_ANALYSIS), cl::cat(PollyCategory));
71
72static cl::opt<Dependences::AnalysisLevel> OptAnalysisLevel(
73 "polly-dependences-analysis-level",
74 cl::desc("The level of dependence analysis"),
75 cl::values(clEnumValN(Dependences::AL_Statement, "statement-wise",
76 "Statement-level analysis"),
77 clEnumValN(Dependences::AL_Reference, "reference-wise",
78 "Memory reference level analysis that distinguish"
79 " accessed references in the same statement"),
80 clEnumValN(Dependences::AL_Access, "access-wise",
81 "Memory reference level analysis that distinguish"
82 " access instructions in the same statement")),
83 cl::Hidden, cl::init(Dependences::AL_Statement), cl::cat(PollyCategory));
84
85//===----------------------------------------------------------------------===//
86
87/// Tag the @p Relation domain with @p TagId
89 __isl_take isl_id *TagId) {
90 isl_space *Space = isl_map_get_space(Relation);
91 Space = isl_space_drop_dims(Space, isl_dim_out, 0,
92 isl_map_dim(Relation, isl_dim_out));
93 Space = isl_space_set_tuple_id(Space, isl_dim_out, TagId);
95 Relation = isl_map_preimage_domain_multi_aff(Relation, Tag);
96 return Relation;
97}
98
99/// Tag the @p Relation domain with either MA->getArrayId() or
100/// MA->getId() based on @p TagLevel
103 if (TagLevel == Dependences::AL_Reference)
104 return tag(Relation, MA->getArrayId().release());
105
106 if (TagLevel == Dependences::AL_Access)
107 return tag(Relation, MA->getId().release());
108
109 // No need to tag at the statement level.
110 return Relation;
111}
112
113/// Collect information about the SCoP @p S.
114static void collectInfo(Scop &S, isl_union_map *&Read,
115 isl_union_map *&MustWrite, isl_union_map *&MayWrite,
116 isl_union_map *&ReductionTagMap,
117 isl_union_set *&TaggedStmtDomain,
119 isl_space *Space = S.getParamSpace().release();
120 Read = isl_union_map_empty(isl_space_copy(Space));
121 MustWrite = isl_union_map_empty(isl_space_copy(Space));
122 MayWrite = isl_union_map_empty(isl_space_copy(Space));
123 ReductionTagMap = isl_union_map_empty(isl_space_copy(Space));
124 isl_union_map *StmtSchedule = isl_union_map_empty(Space);
125
126 SmallPtrSet<const ScopArrayInfo *, 8> ReductionArrays;
127 if (UseReductions)
128 for (ScopStmt &Stmt : S)
129 for (MemoryAccess *MA : Stmt)
130 if (MA->isReductionLike())
131 ReductionArrays.insert(MA->getScopArrayInfo());
132
133 for (ScopStmt &Stmt : S) {
134 for (MemoryAccess *MA : Stmt) {
135 isl_set *domcp = Stmt.getDomain().release();
136 isl_map *accdom = MA->getAccessRelation().release();
137
138 accdom = isl_map_intersect_domain(accdom, domcp);
139
140 if (ReductionArrays.count(MA->getScopArrayInfo())) {
141 // Wrap the access domain and adjust the schedule accordingly.
142 //
143 // An access domain like
144 // Stmt[i0, i1] -> MemAcc_A[i0 + i1]
145 // will be transformed into
146 // [Stmt[i0, i1] -> MemAcc_A[i0 + i1]] -> MemAcc_A[i0 + i1]
147 //
148 // We collect all the access domains in the ReductionTagMap.
149 // This is used in Dependences::calculateDependences to create
150 // a tagged Schedule tree.
151
152 ReductionTagMap =
153 isl_union_map_add_map(ReductionTagMap, isl_map_copy(accdom));
154 accdom = isl_map_range_map(accdom);
155 } else {
156 accdom = tag(accdom, MA, Level);
157 if (Level > Dependences::AL_Statement) {
158 isl_map *StmtScheduleMap = Stmt.getSchedule().release();
159 assert(StmtScheduleMap &&
160 "Schedules that contain extension nodes require special "
161 "handling.");
162 isl_map *Schedule = tag(StmtScheduleMap, MA, Level);
163 StmtSchedule = isl_union_map_add_map(StmtSchedule, Schedule);
164 }
165 }
166
167 if (MA->isRead())
168 Read = isl_union_map_add_map(Read, accdom);
169 else if (MA->isMayWrite())
170 MayWrite = isl_union_map_add_map(MayWrite, accdom);
171 else
172 MustWrite = isl_union_map_add_map(MustWrite, accdom);
173 }
174
175 if (!ReductionArrays.empty() && Level == Dependences::AL_Statement)
176 StmtSchedule =
177 isl_union_map_add_map(StmtSchedule, Stmt.getSchedule().release());
178 }
179
180 StmtSchedule = isl_union_map_intersect_params(
181 StmtSchedule, S.getAssumedContext().release());
182 TaggedStmtDomain = isl_union_map_domain(StmtSchedule);
183
184 ReductionTagMap = isl_union_map_coalesce(ReductionTagMap);
185 Read = isl_union_map_coalesce(Read);
186 MustWrite = isl_union_map_coalesce(MustWrite);
187 MayWrite = isl_union_map_coalesce(MayWrite);
188}
189
190/// Fix all dimension of @p Zero to 0 and add it to @p user
191static void fixSetToZero(isl::set Zero, isl::union_set *User) {
192 for (auto i : rangeIslSize(0, Zero.tuple_dim()))
193 Zero = Zero.fix_si(isl::dim::set, i, 0);
194 *User = User->unite(Zero);
195}
196
197/// Compute the privatization dependences for a given dependency @p Map
198///
199/// Privatization dependences are widened original dependences which originate
200/// or end in a reduction access. To compute them we apply the transitive close
201/// of the reduction dependences (which maps each iteration of a reduction
202/// statement to all following ones) on the RAW/WAR/WAW dependences. The
203/// dependences which start or end at a reduction statement will be extended to
204/// depend on all following reduction statement iterations as well.
205/// Note: "Following" here means according to the reduction dependences.
206///
207/// For the input:
208///
209/// S0: *sum = 0;
210/// for (int i = 0; i < 1024; i++)
211/// S1: *sum += i;
212/// S2: *sum = *sum * 3;
213///
214/// we have the following dependences before we add privatization dependences:
215///
216/// RAW:
217/// { S0[] -> S1[0]; S1[1023] -> S2[] }
218/// WAR:
219/// { }
220/// WAW:
221/// { S0[] -> S1[0]; S1[1024] -> S2[] }
222/// RED:
223/// { S1[i0] -> S1[1 + i0] : i0 >= 0 and i0 <= 1022 }
224///
225/// and afterwards:
226///
227/// RAW:
228/// { S0[] -> S1[i0] : i0 >= 0 and i0 <= 1023;
229/// S1[i0] -> S2[] : i0 >= 0 and i0 <= 1023}
230/// WAR:
231/// { }
232/// WAW:
233/// { S0[] -> S1[i0] : i0 >= 0 and i0 <= 1023;
234/// S1[i0] -> S2[] : i0 >= 0 and i0 <= 1023}
235/// RED:
236/// { S1[i0] -> S1[1 + i0] : i0 >= 0 and i0 <= 1022 }
237///
238/// Note: This function also computes the (reverse) transitive closure of the
239/// reduction dependences.
241 isl_union_map *PrivRAW, *PrivWAW, *PrivWAR;
242
243 // The transitive closure might be over approximated, thus could lead to
244 // dependency cycles in the privatization dependences. To make sure this
245 // will not happen we remove all negative dependences after we computed
246 // the transitive closure.
248
249 // FIXME: Apply the current schedule instead of assuming the identity schedule
250 // here. The current approach is only valid as long as we compute the
251 // dependences only with the initial (identity schedule). Any other
252 // schedule could change "the direction of the backward dependences" we
253 // want to eliminate here.
256 isl::union_set Zero =
258
259 for (isl::set Set : isl::manage_copy(Universe).get_set_list())
260 fixSetToZero(Set, &Zero);
261
262 isl_union_map *NonPositive =
264
265 TC_RED = isl_union_map_subtract(TC_RED, NonPositive);
266
270
271 isl_union_map **Maps[] = {&RAW, &WAW, &WAR};
272 isl_union_map **PrivMaps[] = {&PrivRAW, &PrivWAW, &PrivWAR};
273 for (unsigned u = 0; u < 3; u++) {
274 isl_union_map **Map = Maps[u], **PrivMap = PrivMaps[u];
275
278 *PrivMap = isl_union_map_union(
280 isl_union_map_copy(*Map)));
281
282 *Map = isl_union_map_union(*Map, *PrivMap);
283 }
284
285 isl_union_set_free(Universe);
286}
287
292 __isl_keep isl_schedule *Schedule) {
294
296 if (MaySrc)
298 if (Src)
300 if (Kill)
304 POLLY_DEBUG(if (!Flow) dbgs()
305 << "last error: "
307 << '\n';);
308 return Flow;
309}
310
312 isl_union_map *Read, *MustWrite, *MayWrite, *ReductionTagMap;
313 isl_schedule *Schedule;
314 isl_union_set *TaggedStmtDomain;
315
316 POLLY_DEBUG(dbgs() << "Scop: \n" << S << "\n");
317
318 collectInfo(S, Read, MustWrite, MayWrite, ReductionTagMap, TaggedStmtDomain,
319 Level);
320
321 bool HasReductions = !isl_union_map_is_empty(ReductionTagMap);
322
323 POLLY_DEBUG(dbgs() << "Read: " << Read << '\n';
324 dbgs() << "MustWrite: " << MustWrite << '\n';
325 dbgs() << "MayWrite: " << MayWrite << '\n';
326 dbgs() << "ReductionTagMap: " << ReductionTagMap << '\n';
327 dbgs() << "TaggedStmtDomain: " << TaggedStmtDomain << '\n';);
328
329 Schedule = S.getScheduleTree().release();
330
331 if (!HasReductions) {
332 isl_union_map_free(ReductionTagMap);
333 // Tag the schedule tree if we want fine-grain dependence info
334 if (Level > AL_Statement) {
335 auto TaggedMap =
336 isl_union_set_unwrap(isl_union_set_copy(TaggedStmtDomain));
337 auto Tags = isl_union_map_domain_map_union_pw_multi_aff(TaggedMap);
338 Schedule = isl_schedule_pullback_union_pw_multi_aff(Schedule, Tags);
339 }
340 } else {
341 isl_union_map *IdentityMap;
342 isl_union_pw_multi_aff *ReductionTags, *IdentityTags, *Tags;
343
344 // Extract Reduction tags from the combined access domains in the given
345 // SCoP. The result is a map that maps each tagged element in the domain to
346 // the memory location it accesses. ReductionTags = {[Stmt[i] ->
347 // Array[f(i)]] -> Stmt[i] }
348 ReductionTags =
350
351 // Compute an identity map from each statement in domain to itself.
352 // IdentityTags = { [Stmt[i] -> Stmt[i] }
353 IdentityMap = isl_union_set_identity(isl_union_set_copy(TaggedStmtDomain));
354 IdentityTags = isl_union_pw_multi_aff_from_union_map(IdentityMap);
355
356 Tags = isl_union_pw_multi_aff_union_add(ReductionTags, IdentityTags);
357
358 // By pulling back Tags from Schedule, we have a schedule tree that can
359 // be used to compute normal dependences, as well as 'tagged' reduction
360 // dependences.
361 Schedule = isl_schedule_pullback_union_pw_multi_aff(Schedule, Tags);
362 }
363
364 POLLY_DEBUG(dbgs() << "Read: " << Read << "\n";
365 dbgs() << "MustWrite: " << MustWrite << "\n";
366 dbgs() << "MayWrite: " << MayWrite << "\n";
367 dbgs() << "Schedule: " << Schedule << "\n");
368
369 isl_union_map *StrictWAW = nullptr;
370 {
371 IslMaxOperationsGuard MaxOpGuard(IslCtx.get(), OptComputeOut);
372
373 RAW = WAW = WAR = RED = nullptr;
375 isl_union_map_copy(MayWrite));
376
377 // We are interested in detecting reductions that do not have intermediate
378 // computations that are captured by other statements.
379 //
380 // Example:
381 // void f(int *A, int *B) {
382 // for(int i = 0; i <= 100; i++) {
383 //
384 // *-WAR (S0[i] -> S0[i + 1] 0 <= i <= 100)------------*
385 // | |
386 // *-WAW (S0[i] -> S0[i + 1] 0 <= i <= 100)------------*
387 // | |
388 // v |
389 // S0: *A += i; >------------------*-----------------------*
390 // |
391 // if (i >= 98) { WAR (S0[i] -> S1[i]) 98 <= i <= 100
392 // |
393 // S1: *B = *A; <--------------*
394 // }
395 // }
396 // }
397 //
398 // S0[0 <= i <= 100] has a reduction. However, the values in
399 // S0[98 <= i <= 100] is captured in S1[98 <= i <= 100].
400 // Since we allow free reordering on our reduction dependences, we need to
401 // remove all instances of a reduction statement that have data dependences
402 // originating from them.
403 // In the case of the example, we need to remove S0[98 <= i <= 100] from
404 // our reduction dependences.
405 //
406 // When we build up the WAW dependences that are used to detect reductions,
407 // we consider only **Writes that have no intermediate Reads**.
408 //
409 // `isl_union_flow_get_must_dependence` gives us dependences of the form:
410 // (sink <- must_source).
411 //
412 // It *will not give* dependences of the form:
413 // 1. (sink <- ... <- may_source <- ... <- must_source)
414 // 2. (sink <- ... <- must_source <- ... <- must_source)
415 //
416 // For a detailed reference on ISL's flow analysis, see:
417 // "Presburger Formulas and Polyhedral Compilation" - Approximate Dataflow
418 // Analysis.
419 //
420 // Since we set "Write" as a must-source, "Read" as a may-source, and ask
421 // for must dependences, we get all Writes to Writes that **do not flow
422 // through a Read**.
423 //
424 // ScopInfo::checkForReductions makes sure that if something captures
425 // the reduction variable in the same basic block, then it is rejected
426 // before it is even handed here. This makes sure that there is exactly
427 // one read and one write to a reduction variable in a Statement.
428 // Example:
429 // void f(int *sum, int A[N], int B[N]) {
430 // for (int i = 0; i < N; i++) {
431 // *sum += A[i]; < the store and the load is not tagged as a
432 // B[i] = *sum; < reduction-like access due to the overlap.
433 // }
434 // }
435
436 isl_union_flow *Flow = buildFlow(Write, Write, Read, nullptr, Schedule);
437 StrictWAW = isl_union_flow_get_must_dependence(Flow);
439
441 Flow = buildFlow(Read, MustWrite, MayWrite, nullptr, Schedule);
444
445 Flow = buildFlow(Write, MustWrite, MayWrite, nullptr, Schedule);
448
449 // ISL now supports "kills" in approximate dataflow analysis, we can
450 // specify the MustWrite as kills, Read as source and Write as sink.
451 Flow = buildFlow(Write, nullptr, Read, MustWrite, Schedule);
454 } else {
455 Flow = buildFlow(Read, nullptr, Write, nullptr, Schedule);
458
459 Flow = buildFlow(Write, nullptr, Read, nullptr, Schedule);
462
463 Flow = buildFlow(Write, nullptr, Write, nullptr, Schedule);
466 }
467
468 isl_union_map_free(Write);
469 isl_union_map_free(MustWrite);
470 isl_union_map_free(MayWrite);
471 isl_union_map_free(Read);
472 isl_schedule_free(Schedule);
473
477
478 // End of max_operations scope.
479 }
480
485 isl_union_map_free(StrictWAW);
486 RAW = WAW = WAR = StrictWAW = nullptr;
488 }
489
490 // Drop out early, as the remaining computations are only needed for
491 // reduction dependences or dependences that are finer than statement
492 // level dependences.
493 if (!HasReductions && Level == AL_Statement) {
496 isl_union_set_free(TaggedStmtDomain);
497 isl_union_map_free(StrictWAW);
498 return;
499 }
500
501 isl_union_map *STMT_RAW, *STMT_WAW, *STMT_WAR;
503 isl_union_map_copy(RAW), isl_union_set_copy(TaggedStmtDomain));
505 isl_union_map_copy(WAW), isl_union_set_copy(TaggedStmtDomain));
506 STMT_WAR =
509 dbgs() << "Wrapped Dependences:\n";
510 dump();
511 dbgs() << "\n";
512 });
513
514 // To handle reduction dependences we proceed as follows:
515 // 1) Aggregate all possible reduction dependences, namely all self
516 // dependences on reduction like statements.
517 // 2) Intersect them with the actual RAW & WAW dependences to the get the
518 // actual reduction dependences. This will ensure the load/store memory
519 // addresses were __identical__ in the two iterations of the statement.
520 // 3) Relax the original RAW, WAW and WAR dependences by subtracting the
521 // actual reduction dependences. Binary reductions (sum += A[i]) cause
522 // the same, RAW, WAW and WAR dependences.
523 // 4) Add the privatization dependences which are widened versions of
524 // already present dependences. They model the effect of manual
525 // privatization at the outermost possible place (namely after the last
526 // write and before the first access to a reduction location).
527
528 // Step 1)
530 for (ScopStmt &Stmt : S) {
531 for (MemoryAccess *MA : Stmt) {
532 if (!MA->isReductionLike())
533 continue;
534 isl_set *AccDomW = isl_map_wrap(MA->getAccessRelation().release());
535 isl_map *Identity =
537 RED = isl_union_map_add_map(RED, Identity);
538 }
539 }
540
541 // Step 2)
543 RED = isl_union_map_intersect(RED, StrictWAW);
544
546
547 // Step 3)
551
552 // Step 4)
554 } else
556
558 dbgs() << "Final Wrapped Dependences:\n";
559 dump();
560 dbgs() << "\n";
561 });
562
563 // RED_SIN is used to collect all reduction dependences again after we
564 // split them according to the causing memory accesses. The current assumption
565 // is that our method of splitting will not have any leftovers. In the end
566 // we validate this assumption until we have more confidence in this method.
568
569 // For each reduction like memory access, check if there are reduction
570 // dependences with the access relation of the memory access as a domain
571 // (wrapped space!). If so these dependences are caused by this memory access.
572 // We then move this portion of reduction dependences back to the statement ->
573 // statement space and add a mapping from the memory access to these
574 // dependences.
575 for (ScopStmt &Stmt : S) {
576 for (MemoryAccess *MA : Stmt) {
577 if (!MA->isReductionLike())
578 continue;
579
580 isl_set *AccDomW = isl_map_wrap(MA->getAccessRelation().release());
583 if (isl_union_map_is_empty(AccRedDepU)) {
584 isl_union_map_free(AccRedDepU);
585 continue;
586 }
587
588 isl_map *AccRedDep = isl_map_from_union_map(AccRedDepU);
589 RED_SIN = isl_union_map_add_map(RED_SIN, isl_map_copy(AccRedDep));
590 AccRedDep = isl_map_zip(AccRedDep);
591 AccRedDep = isl_set_unwrap(isl_map_domain(AccRedDep));
592 setReductionDependences(MA, AccRedDep);
593 }
594 }
595
597 "Intersecting the reduction dependence domain with the wrapped access "
598 "relation is not enough, we need to loosen the access relation also");
599 isl_union_map_free(RED_SIN);
600
606
608 dbgs() << "Zipped Dependences:\n";
609 dump();
610 dbgs() << "\n";
611 });
612
618
620 dbgs() << "Unwrapped Dependences:\n";
621 dump();
622 dbgs() << "\n";
623 });
624
625 RAW = isl_union_map_union(RAW, STMT_RAW);
626 WAW = isl_union_map_union(WAW, STMT_WAW);
627 WAR = isl_union_map_union(WAR, STMT_WAR);
628
634
635 POLLY_DEBUG(dump());
636}
637
639 // TODO: Also check permutable/coincident flags as well.
640
641 StatementToIslMapTy NewSchedules;
642 for (auto NewMap : NewSched.get_map().get_map_list()) {
643 auto Stmt = reinterpret_cast<ScopStmt *>(
644 NewMap.get_tuple_id(isl::dim::in).get_user());
645 NewSchedules[Stmt] = NewMap;
646 }
647
648 return isValidSchedule(S, NewSchedules);
649}
650
652 Scop &S, const StatementToIslMapTy &NewSchedule) const {
654 return true;
655
657 isl::union_map Schedule = isl::union_map::empty(S.getIslCtx());
658
659 isl::space ScheduleSpace;
660
661 for (ScopStmt &Stmt : S) {
662 isl::map StmtScat;
663
664 auto Lookup = NewSchedule.find(&Stmt);
665 if (Lookup == NewSchedule.end())
666 StmtScat = Stmt.getSchedule();
667 else
668 StmtScat = Lookup->second;
669 assert(!StmtScat.is_null() &&
670 "Schedules that contain extension nodes require special handling.");
671
672 if (ScheduleSpace.is_null())
673 ScheduleSpace = StmtScat.get_space().range();
674
675 Schedule = Schedule.unite(StmtScat);
676 }
677
678 Dependences = Dependences.apply_domain(Schedule);
679 Dependences = Dependences.apply_range(Schedule);
680
681 isl::set Zero = isl::set::universe(ScheduleSpace);
682 for (auto i : rangeIslSize(0, Zero.tuple_dim()))
683 Zero = Zero.fix_si(isl::dim::set, i, 0);
684
685 isl::union_set UDeltas = Dependences.deltas();
686 isl::set Deltas = singleton(UDeltas, ScheduleSpace);
687
688 isl::space Space = Deltas.get_space();
689 isl::map NonPositive = isl::map::universe(Space.map_from_set());
690 NonPositive =
692 NonPositive = NonPositive.intersect_domain(Deltas);
693 NonPositive = NonPositive.intersect_range(Zero);
694
695 return NonPositive.is_empty();
696}
697
698// Check if the current scheduling dimension is parallel.
699//
700// We check for parallelism by verifying that the loop does not carry any
701// dependences.
702//
703// Parallelism test: if the distance is zero in all outer dimensions, then it
704// has to be zero in the current dimension as well.
705//
706// Implementation: first, translate dependences into time space, then force
707// outer dimensions to be equal. If the distance is zero in the current
708// dimension, then the loop is parallel. The distance is zero in the current
709// dimension if it is a subset of a map with equal values for the current
710// dimension.
713 __isl_give isl_pw_aff **MinDistancePtr) const {
714 isl_set *Deltas, *Distance;
715 isl_map *ScheduleDeps;
716 unsigned Dimension;
717 bool IsParallel;
718
719 Deps = isl_union_map_apply_range(Deps, isl_union_map_copy(Schedule));
720 Deps = isl_union_map_apply_domain(Deps, isl_union_map_copy(Schedule));
721
722 if (isl_union_map_is_empty(Deps)) {
723 isl_union_map_free(Deps);
724 return true;
725 }
726
727 ScheduleDeps = isl_map_from_union_map(Deps);
728 Dimension = isl_map_dim(ScheduleDeps, isl_dim_out) - 1;
729
730 for (unsigned i = 0; i < Dimension; i++)
731 ScheduleDeps = isl_map_equate(ScheduleDeps, isl_dim_out, i, isl_dim_in, i);
732
733 Deltas = isl_map_deltas(ScheduleDeps);
734 Distance = isl_set_universe(isl_set_get_space(Deltas));
735
736 // [0, ..., 0, +] - All zeros and last dimension larger than zero
737 for (unsigned i = 0; i < Dimension; i++)
738 Distance = isl_set_fix_si(Distance, isl_dim_set, i, 0);
739
740 Distance = isl_set_lower_bound_si(Distance, isl_dim_set, Dimension, 1);
741 Distance = isl_set_intersect(Distance, Deltas);
742
743 IsParallel = isl_set_is_empty(Distance);
744 if (IsParallel || !MinDistancePtr) {
745 isl_set_free(Distance);
746 return IsParallel;
747 }
748
749 Distance = isl_set_project_out(Distance, isl_dim_set, 0, Dimension);
750 Distance = isl_set_coalesce(Distance);
751
752 // This last step will compute a expression for the minimal value in the
753 // distance polyhedron Distance with regards to the first (outer most)
754 // dimension.
755 *MinDistancePtr = isl_pw_aff_coalesce(isl_set_dim_min(Distance, 0));
756
757 return false;
758}
759
760static void printDependencyMap(raw_ostream &OS, __isl_keep isl_union_map *DM) {
761 if (DM)
762 OS << DM << "\n";
763 else
764 OS << "n/a\n";
765}
766
767void Dependences::print(raw_ostream &OS) const {
768 OS << "\tRAW dependences:\n\t\t";
770 OS << "\tWAR dependences:\n\t\t";
772 OS << "\tWAW dependences:\n\t\t";
774 OS << "\tReduction dependences:\n\t\t";
776 OS << "\tTransitive closure of reduction dependences:\n\t\t";
778}
779
780void Dependences::dump() const { print(dbgs()); }
781
788
789 RED = RAW = WAR = WAW = TC_RED = nullptr;
790
791 for (auto &ReductionDeps : ReductionDependences)
792 isl_map_free(ReductionDeps.second);
793 ReductionDependences.clear();
794}
795
797 assert(hasValidDependences() && "No valid dependences available");
798 isl::space Space = isl::manage_copy(RAW).get_space();
799 isl::union_map Deps = Deps.empty(Space.ctx());
800
801 if (Kinds & TYPE_RAW)
802 Deps = Deps.unite(isl::manage_copy(RAW));
803
804 if (Kinds & TYPE_WAR)
805 Deps = Deps.unite(isl::manage_copy(WAR));
806
807 if (Kinds & TYPE_WAW)
808 Deps = Deps.unite(isl::manage_copy(WAW));
809
810 if (Kinds & TYPE_RED)
811 Deps = Deps.unite(isl::manage_copy(RED));
812
813 if (Kinds & TYPE_TC_RED)
814 Deps = Deps.unite(isl::manage_copy(TC_RED));
815
816 Deps = Deps.coalesce();
817 Deps = Deps.detect_equalities();
818 return Deps;
819}
820
822 return (RAW != nullptr) && (WAR != nullptr) && (WAW != nullptr);
823}
824
827 return isl_map_copy(ReductionDependences.lookup(MA));
828}
829
831 __isl_take isl_map *D) {
832 assert(ReductionDependences.count(MA) == 0 &&
833 "Reduction dependences set twice!");
834 ReductionDependences[MA] = D;
835}
836
837const Dependences &
839 if (Dependences *d = D[Level].get())
840 return *d;
841
842 return recomputeDependences(Level);
843}
844
847 D[Level].reset(new Dependences(S.getSharedIslCtx(), Level));
848 D[Level]->calculateDependences(S);
849 return *D[Level];
850}
851
853 for (std::unique_ptr<Dependences> &Deps : D)
854 Deps.release();
855}
856
860 return {S, {}};
861}
862
863AnalysisKey DependenceAnalysis::Key;
864
865PreservedAnalyses
868 SPMUpdater &U) {
869 auto &DI = SAM.getResult<DependenceAnalysis>(S, SAR);
870
871 if (auto d = DI.D[OptAnalysisLevel].get()) {
872 d->print(OS);
873 return PreservedAnalyses::all();
874 }
875
876 // Otherwise create the dependences on-the-fly and print them
877 Dependences D(S.getSharedIslCtx(), OptAnalysisLevel);
879 D.print(OS);
880
881 return PreservedAnalyses::all();
882}
883
884const Dependences &
886 if (Dependences *d = D[Level].get())
887 return *d;
888
889 return recomputeDependences(Level);
890}
891
892const Dependences &
894 D[Level].reset(new Dependences(S->getSharedIslCtx(), Level));
895 D[Level]->calculateDependences(*S);
896 return *D[Level];
897}
898
900 for (std::unique_ptr<Dependences> &Deps : D)
901 Deps.release();
902}
903
905 S = &ScopVar;
906 return false;
907}
908
909/// Print the dependences for the given SCoP to @p OS.
910
911void polly::DependenceInfo::printScop(raw_ostream &OS, Scop &S) const {
912 if (auto d = D[OptAnalysisLevel].get()) {
913 d->print(OS);
914 return;
915 }
916
917 // Otherwise create the dependences on-the-fly and print it
918 Dependences D(S.getSharedIslCtx(), OptAnalysisLevel);
920 D.print(OS);
921}
922
923void DependenceInfo::getAnalysisUsage(AnalysisUsage &AU) const {
924 AU.addRequiredTransitive<ScopInfoRegionPass>();
925 AU.setPreservesAll();
926}
927
928char DependenceInfo::ID = 0;
929
931
933 "Polly - Calculate dependences", false, false);
936 "Polly - Calculate dependences", false, false)
937
938//===----------------------------------------------------------------------===//
939
940namespace {
941/// Print result from DependenceAnalysis.
942class DependenceInfoPrinterLegacyPass final : public ScopPass {
943public:
944 static char ID;
945
946 DependenceInfoPrinterLegacyPass() : DependenceInfoPrinterLegacyPass(outs()) {}
947
948 explicit DependenceInfoPrinterLegacyPass(llvm::raw_ostream &OS)
949 : ScopPass(ID), OS(OS) {}
950
951 bool runOnScop(Scop &S) override {
952 DependenceInfo &P = getAnalysis<DependenceInfo>();
953
954 OS << "Printing analysis '" << P.getPassName() << "' for "
955 << "region: '" << S.getRegion().getNameStr() << "' in function '"
956 << S.getFunction().getName() << "':\n";
957 P.printScop(OS, S);
958
959 return false;
960 }
961
962 void getAnalysisUsage(AnalysisUsage &AU) const override {
964 AU.addRequired<DependenceInfo>();
965 AU.setPreservesAll();
966 }
967
968private:
969 llvm::raw_ostream &OS;
970};
971
972char DependenceInfoPrinterLegacyPass::ID = 0;
973} // namespace
974
976 return new DependenceInfoPrinterLegacyPass(OS);
977}
978
979INITIALIZE_PASS_BEGIN(DependenceInfoPrinterLegacyPass,
980 "polly-print-dependences", "Polly - Print dependences",
981 false, false);
983INITIALIZE_PASS_END(DependenceInfoPrinterLegacyPass, "polly-print-dependences",
984 "Polly - Print dependences", false, false)
985
986//===----------------------------------------------------------------------===//
987
988const Dependences &
989DependenceInfoWrapperPass::getDependences(Scop *S,
990 Dependences::AnalysisLevel Level) {
991 auto It = ScopToDepsMap.find(S);
992 if (It != ScopToDepsMap.end())
993 if (It->second) {
994 if (It->second->getDependenceLevel() == Level)
995 return *It->second.get();
996 }
997 return recomputeDependences(S, Level);
998}
999
1002 std::unique_ptr<Dependences> D(new Dependences(S->getSharedIslCtx(), Level));
1003 D->calculateDependences(*S);
1004 auto Inserted = ScopToDepsMap.insert(std::make_pair(S, std::move(D)));
1005 return *Inserted.first->second;
1006}
1007
1009 auto &SI = *getAnalysis<ScopInfoWrapperPass>().getSI();
1010 for (auto &It : SI) {
1011 assert(It.second && "Invalid SCoP object!");
1012 recomputeDependences(It.second.get(), Dependences::AL_Access);
1013 }
1014 return false;
1015}
1016
1017void DependenceInfoWrapperPass::print(raw_ostream &OS, const Module *M) const {
1018 for (auto &It : ScopToDepsMap) {
1019 assert((It.first && It.second) && "Invalid Scop or Dependence object!\n");
1020 It.second->print(OS);
1021 }
1022}
1023
1024void DependenceInfoWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const {
1025 AU.addRequiredTransitive<ScopInfoWrapperPass>();
1026 AU.setPreservesAll();
1027}
1028
1030
1032 return new DependenceInfoWrapperPass();
1033}
1034
1036 DependenceInfoWrapperPass, "polly-function-dependences",
1037 "Polly - Calculate dependences for all the SCoPs of a function", false,
1038 false)
1042 "Polly - Calculate dependences for all the SCoPs of a function", false,
1043 false)
1044
1045//===----------------------------------------------------------------------===//
1046
1047namespace {
1048/// Print result from DependenceInfoWrapperPass.
1049class DependenceInfoPrinterLegacyFunctionPass final : public FunctionPass {
1050public:
1051 static char ID;
1052
1053 DependenceInfoPrinterLegacyFunctionPass()
1054 : DependenceInfoPrinterLegacyFunctionPass(outs()) {}
1055
1056 explicit DependenceInfoPrinterLegacyFunctionPass(llvm::raw_ostream &OS)
1057 : FunctionPass(ID), OS(OS) {}
1058
1059 bool runOnFunction(Function &F) override {
1060 DependenceInfoWrapperPass &P = getAnalysis<DependenceInfoWrapperPass>();
1061
1062 OS << "Printing analysis '" << P.getPassName() << "' for function '"
1063 << F.getName() << "':\n";
1064 P.print(OS);
1065
1066 return false;
1067 }
1068
1069 void getAnalysisUsage(AnalysisUsage &AU) const override {
1070 FunctionPass::getAnalysisUsage(AU);
1071 AU.addRequired<DependenceInfoWrapperPass>();
1072 AU.setPreservesAll();
1073 }
1074
1075private:
1076 llvm::raw_ostream &OS;
1077};
1078
1079char DependenceInfoPrinterLegacyFunctionPass::ID = 0;
1080} // namespace
1081
1083 return new DependenceInfoPrinterLegacyFunctionPass(OS);
1084}
1085
1087 DependenceInfoPrinterLegacyFunctionPass, "polly-print-function-dependences",
1088 "Polly - Print dependences for all the SCoPs of a function", false, false);
1090INITIALIZE_PASS_END(DependenceInfoPrinterLegacyFunctionPass,
1091 "polly-print-function-dependences",
1092 "Polly - Print dependences for all the SCoPs of a function",
1093 false, false)
INITIALIZE_PASS_BEGIN(DependenceInfo, "polly-dependences", "Polly - Calculate dependences", false, false)
static __isl_give isl_union_flow * buildFlow(__isl_keep isl_union_map *Snk, __isl_keep isl_union_map *Src, __isl_keep isl_union_map *MaySrc, __isl_keep isl_union_map *Kill, __isl_keep isl_schedule *Schedule)
static cl::opt< int > OptComputeOut("polly-dependences-computeout", cl::desc("Bound the dependence analysis by a maximal amount of " "computational steps (0 means no bound)"), cl::Hidden, cl::init(500000), cl::cat(PollyCategory))
AnalysisType
@ MEMORY_BASED_ANALYSIS
@ VALUE_BASED_ANALYSIS
static cl::opt< Dependences::AnalysisLevel > OptAnalysisLevel("polly-dependences-analysis-level", cl::desc("The level of dependence analysis"), cl::values(clEnumValN(Dependences::AL_Statement, "statement-wise", "Statement-level analysis"), clEnumValN(Dependences::AL_Reference, "reference-wise", "Memory reference level analysis that distinguish" " accessed references in the same statement"), clEnumValN(Dependences::AL_Access, "access-wise", "Memory reference level analysis that distinguish" " access instructions in the same statement")), cl::Hidden, cl::init(Dependences::AL_Statement), cl::cat(PollyCategory))
static void printDependencyMap(raw_ostream &OS, __isl_keep isl_union_map *DM)
static cl::opt< bool > LegalityCheckDisabled("disable-polly-legality", cl::desc("Disable polly legality check"), cl::Hidden, cl::cat(PollyCategory))
static void fixSetToZero(isl::set Zero, isl::union_set *User)
Fix all dimension of Zero to 0 and add it to user.
static cl::opt< enum AnalysisType > OptAnalysisType("polly-dependences-analysis-type", cl::desc("The kind of dependence analysis to use"), cl::values(clEnumValN(VALUE_BASED_ANALYSIS, "value-based", "Exact dependences without transitive dependences"), clEnumValN(MEMORY_BASED_ANALYSIS, "memory-based", "Overapproximation of dependences")), cl::Hidden, cl::init(VALUE_BASED_ANALYSIS), cl::cat(PollyCategory))
INITIALIZE_PASS_END(DependenceInfo, "polly-dependences", "Polly - Calculate dependences", false, false) namespace
INITIALIZE_PASS_DEPENDENCY(ScopInfoRegionPass)
static void collectInfo(Scop &S, isl_union_map *&Read, isl_union_map *&MustWrite, isl_union_map *&MayWrite, isl_union_map *&ReductionTagMap, isl_union_set *&TaggedStmtDomain, Dependences::AnalysisLevel Level)
Collect information about the SCoP S.
static __isl_give isl_map * tag(__isl_take isl_map *Relation, __isl_take isl_id *TagId)
Tag the Relation domain with TagId.
static cl::opt< bool > UseReductions("polly-dependences-use-reductions", cl::desc("Exploit reductions in dependence analysis"), cl::Hidden, cl::init(true), cl::cat(PollyCategory))
polly dump function
polly dump Polly Dump Function
llvm::cl::OptionCategory PollyCategory
#define POLLY_DEBUG(X)
Definition: PollyDebug.h:23
polly prune Polly Prune unprofitable SCoPs
static RegisterPass< ScopPrinterWrapperPass > M("dot-scops", "Polly - Print Scops of function")
__isl_export __isl_give isl_multi_aff * isl_multi_aff_domain_map(__isl_take isl_space *space)
Definition: isl_aff.c:4124
__isl_export __isl_give isl_union_pw_multi_aff * isl_union_pw_multi_aff_union_add(__isl_take isl_union_pw_multi_aff *upma1, __isl_take isl_union_pw_multi_aff *upma2)
__isl_export __isl_give isl_pw_aff * isl_pw_aff_coalesce(__isl_take isl_pw_aff *pa)
__isl_give isl_union_pw_multi_aff * isl_union_pw_multi_aff_from_union_map(__isl_take isl_union_map *umap)
Definition: isl_aff.c:5654
struct isl_union_pw_multi_aff isl_union_pw_multi_aff
Definition: aff_type.h:38
struct isl_multi_aff isl_multi_aff
Definition: aff_type.h:29
for(int c0=1;c0< 3 *M - 1;c0+=3)
Definition: cholesky2.c:6
__isl_give isl_id * release()
static isl::map universe(isl::space space)
isl::map lex_le_at(isl::multi_pw_aff mpa) const
isl::map intersect_range(isl::set set) const
isl::space get_space() const
boolean is_empty() const
isl::map intersect_domain(isl::set set) const
bool is_null() const
static isl::multi_pw_aff identity_on_domain(isl::space space)
isl::union_map get_map() const
static isl::set universe(isl::space space)
isl::set fix_si(isl::dim type, unsigned int pos, int value) const
class size tuple_dim() const
isl::space get_space() const
bool is_null() const
isl::ctx ctx() const
isl::space map_from_set() const
isl::space range() const
isl::union_map unite(isl::union_map umap2) const
isl::map_list get_map_list() const
isl::union_map coalesce() const
static isl::union_map empty(isl::ctx ctx)
isl::union_map detect_equalities() const
__isl_give isl_union_set * release()
isl::union_set unite(isl::union_set uset2) const
Construct a new DependenceInfoWrapper pass.
bool runOnFunction(Function &F) override
Compute the dependence information on-the-fly for the function.
void getAnalysisUsage(AnalysisUsage &AU) const override
Register all analyses and transformation required.
const Dependences & recomputeDependences(Scop *S, Dependences::AnalysisLevel Level)
Recompute dependences from schedule and memory accesses.
void print(raw_ostream &OS, const Module *M=nullptr) const override
Print the dependences for the current function to OS.
void printScop(raw_ostream &OS, Scop &) const override
Print the dependences for the given SCoP to OS.
void getAnalysisUsage(AnalysisUsage &AU) const override
Register all analyses and transformation required.
const Dependences & getDependences(Dependences::AnalysisLevel Level)
Return the dependence information for the current SCoP.
const Dependences & recomputeDependences(Dependences::AnalysisLevel Level)
Recompute dependences from schedule and memory accesses.
bool runOnScop(Scop &S) override
Compute the dependence information for the SCoP S.
void abandonDependences()
Invalidate the dependence information and recompute it when needed again.
The accumulated dependence information for a SCoP.
void setReductionDependences(MemoryAccess *MA, __isl_take isl_map *Deps)
Set the reduction dependences for MA to Deps.
DenseMap< ScopStmt *, isl::map > StatementToIslMapTy
Map type to associate statements with schedules.
isl_union_map * TC_RED
The (reverse) transitive closure of reduction dependences.
void addPrivatizationDependences()
Calculate and add at the privatization dependences.
bool isParallel(__isl_keep isl_union_map *Schedule, __isl_take isl_union_map *Deps, __isl_give isl_pw_aff **MinDistancePtr=nullptr) const
Check if a partial schedule is parallel wrt to Deps.
const AnalysisLevel Level
Granularity of this dependence analysis.
isl_union_map * WAW
void print(llvm::raw_ostream &OS) const
Print the stored dependence information.
const ReductionDependencesMapTy & getReductionDependences() const
Return all reduction dependences.
void calculateDependences(Scop &S)
Calculate the dependences for a certain SCoP S.
bool hasValidDependences() const
Report if valid dependences are available.
isl_union_map * RED
The special reduction dependences.
isl_union_map * RAW
The different basic kinds of dependences we calculate.
void dump() const
Dump the dependence information stored to the dbgs stream.
isl::union_map getDependences(int Kinds) const
Get the dependences of type Kinds.
bool isValidSchedule(Scop &S, const StatementToIslMapTy &NewSchedules) const
Check if a new schedule is valid.
void releaseMemory()
Free the objects associated with this Dependences struct.
std::shared_ptr< isl_ctx > IslCtx
Isl context from the SCoP.
isl_union_map * WAR
ReductionDependencesMapTy ReductionDependences
Mapping from memory accesses to their reduction dependences.
Scoped limit of ISL operations.
Definition: GICHelper.h:424
Represent memory accesses in statements.
Definition: ScopInfo.h:431
isl::id getArrayId() const
Old name of getOriginalArrayId().
Definition: ScopInfo.h:841
isl::id getId() const
Get identifier for the memory access.
Definition: ScopInfo.cpp:914
The legacy pass manager's analysis pass to compute scop information for a region.
Definition: ScopInfo.h:2677
The legacy pass manager's analysis pass to compute scop information for the whole function.
Definition: ScopInfo.h:2791
ScopPass - This class adapts the RegionPass interface to allow convenient creation of passes that ope...
Definition: ScopPass.h:161
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
Definition: ScopPass.cpp:44
Statement of the Scop.
Definition: ScopInfo.h:1138
Static Control Part.
Definition: ScopInfo.h:1628
#define __isl_take
Definition: ctx.h:22
enum isl_error isl_ctx_last_error(isl_ctx *ctx)
Definition: isl_ctx.c:321
#define __isl_give
Definition: ctx.h:19
@ isl_error_quota
Definition: ctx.h:81
void isl_ctx_reset_error(isl_ctx *ctx)
Definition: isl_ctx.c:347
#define __isl_keep
Definition: ctx.h:25
__isl_export __isl_give isl_union_access_info * isl_union_access_info_set_schedule(__isl_take isl_union_access_info *access, __isl_take isl_schedule *schedule)
Definition: isl_flow.c:1706
__isl_null isl_union_flow * isl_union_flow_free(__isl_take isl_union_flow *flow)
Definition: isl_flow.c:2108
__isl_export __isl_give isl_union_access_info * isl_union_access_info_set_may_source(__isl_take isl_union_access_info *access, __isl_take isl_union_map *may_source)
Definition: isl_flow.c:1640
__isl_export __isl_give isl_union_access_info * isl_union_access_info_set_must_source(__isl_take isl_union_access_info *access, __isl_take isl_union_map *must_source)
Definition: isl_flow.c:1630
__isl_constructor __isl_give isl_union_access_info * isl_union_access_info_from_sink(__isl_take isl_union_map *sink)
Definition: isl_flow.c:1590
__isl_export __isl_give isl_union_access_info * isl_union_access_info_set_kill(__isl_take isl_union_access_info *access, __isl_take isl_union_map *kill)
Definition: isl_flow.c:1650
__isl_export __isl_give isl_union_flow * isl_union_access_info_compute_flow(__isl_take isl_union_access_info *access)
Definition: isl_flow.c:3206
__isl_export __isl_give isl_union_map * isl_union_flow_get_must_dependence(__isl_keep isl_union_flow *flow)
Definition: isl_flow.c:2159
__isl_export __isl_give isl_union_map * isl_union_flow_get_may_dependence(__isl_keep isl_union_flow *flow)
Definition: isl_flow.c:2173
static int all(int *con, unsigned len, int status)
Definition: isl_coalesce.c:163
#define assert(exp)
__isl_export __isl_give isl_set * isl_map_domain(__isl_take isl_map *bmap)
Definition: isl_map.c:8129
__isl_export __isl_give isl_map * isl_map_zip(__isl_take isl_map *map)
Definition: isl_map.c:13122
__isl_give isl_map * isl_map_copy(__isl_keep isl_map *map)
Definition: isl_map.c:1494
__isl_export __isl_give isl_space * isl_map_get_space(__isl_keep isl_map *map)
Definition: isl_map.c:598
__isl_give isl_map * isl_map_from_domain_and_range(__isl_take isl_set *domain, __isl_take isl_set *range)
Definition: isl_map.c:6228
__isl_export __isl_give isl_map * isl_map_intersect_domain(__isl_take isl_map *map, __isl_take isl_set *set)
Definition: isl_map.c:8353
__isl_export __isl_give isl_set * isl_map_deltas(__isl_take isl_map *map)
Definition: isl_map.c:8777
__isl_give isl_map * isl_map_range_map(__isl_take isl_map *map)
Definition: isl_map.c:6158
__isl_export __isl_give isl_map * isl_set_unwrap(__isl_take isl_set *set)
Definition: isl_map.c:12239
__isl_export __isl_give isl_set * isl_map_wrap(__isl_take isl_map *map)
Definition: isl_map.c:12213
isl_size isl_map_dim(__isl_keep isl_map *map, enum isl_dim_type type)
Definition: isl_map.c:110
__isl_overload __isl_give isl_map * isl_map_preimage_domain_multi_aff(__isl_take isl_map *map, __isl_take isl_multi_aff *ma)
Definition: isl_map.c:14057
__isl_give isl_map * isl_map_equate(__isl_take isl_map *map, enum isl_dim_type type1, int pos1, enum isl_dim_type type2, int pos2)
Definition: isl_map.c:13327
__isl_null isl_map * isl_map_free(__isl_take isl_map *map)
Definition: isl_map.c:6421
struct isl_set isl_set
Definition: map_type.h:26
aff manage_copy(__isl_keep isl_aff *ptr)
boolean manage(isl_bool val)
This file contains the declaration of the PolyhedralInfo class, which will provide an interface to ex...
llvm::Pass * createDependenceInfoPass()
llvm::iota_range< unsigned > rangeIslSize(unsigned Begin, isl::size End)
Check that End is valid and return an iterator from Begin to End.
Definition: ISLTools.cpp:597
llvm::Pass * createDependenceInfoWrapperPassPass()
llvm::Pass * createDependenceInfoPrinterLegacyPass(llvm::raw_ostream &OS)
llvm::Pass * createDependenceInfoPrinterLegacyFunctionPass(llvm::raw_ostream &OS)
AnalysisManager< Scop, ScopStandardAnalysisResults & > ScopAnalysisManager
Definition: ScopPass.h:46
isl::map singleton(isl::union_map UMap, isl::space ExpectedSpace)
If by construction a union map is known to contain only a single map, return it.
Definition: ISLTools.cpp:135
__isl_null isl_schedule * isl_schedule_free(__isl_take isl_schedule *sched)
Definition: isl_schedule.c:121
__isl_give isl_schedule * isl_schedule_copy(__isl_keep isl_schedule *sched)
Definition: isl_schedule.c:93
isl_ctx * isl_schedule_get_ctx(__isl_keep isl_schedule *sched)
Definition: isl_schedule.c:160
__isl_overload __isl_give isl_schedule * isl_schedule_pullback_union_pw_multi_aff(__isl_take isl_schedule *schedule, __isl_take isl_union_pw_multi_aff *upma)
Definition: isl_schedule.c:348
a(0)
__isl_export __isl_give isl_set * isl_set_universe(__isl_take isl_space *space)
Definition: isl_map.c:6366
__isl_export __isl_give isl_set * isl_set_coalesce(__isl_take isl_set *set)
__isl_export __isl_give isl_space * isl_set_get_space(__isl_keep isl_set *set)
Definition: isl_map.c:603
__isl_give isl_set * isl_set_lower_bound_si(__isl_take isl_set *set, enum isl_dim_type type, unsigned pos, int value)
Definition: isl_map.c:6803
__isl_give isl_pw_aff * isl_set_dim_min(__isl_take isl_set *set, int pos)
Definition: isl_map.c:7519
__isl_null isl_set * isl_set_free(__isl_take isl_set *set)
Definition: isl_map.c:3513
__isl_give isl_set * isl_set_copy(__isl_keep isl_set *set)
Definition: isl_map.c:1470
__isl_give isl_set * isl_set_project_out(__isl_take isl_set *set, enum isl_dim_type type, unsigned first, unsigned n)
Definition: isl_map.c:4639
__isl_export __isl_give isl_set * isl_set_intersect(__isl_take isl_set *set1, __isl_take isl_set *set2)
Definition: isl_map.c:3965
__isl_give isl_set * isl_set_fix_si(__isl_take isl_set *set, enum isl_dim_type type, unsigned pos, int value)
Definition: isl_map.c:6634
__isl_export isl_bool isl_set_is_empty(__isl_keep isl_set *set)
Definition: isl_map.c:9163
__isl_give isl_space * isl_space_set_tuple_id(__isl_take isl_space *space, enum isl_dim_type type, __isl_take isl_id *id)
Definition: isl_space.c:636
__isl_give isl_space * isl_space_copy(__isl_keep isl_space *space)
Definition: isl_space.c:436
__isl_give isl_space * isl_space_drop_dims(__isl_take isl_space *space, enum isl_dim_type type, unsigned first, unsigned num)
Definition: isl_space.c:2047
@ isl_dim_in
Definition: space_type.h:16
@ isl_dim_set
Definition: space_type.h:18
@ isl_dim_out
Definition: space_type.h:17
const Dependences & getDependences(Dependences::AnalysisLevel Level)
Return the dependence information for the current SCoP.
std::unique_ptr< Dependences > D[Dependences::NumAnalysisLevels]
const Dependences & recomputeDependences(Dependences::AnalysisLevel Level)
Recompute dependences from schedule and memory accesses.
void abandonDependences()
Invalidate the dependence information and recompute it when needed again.
Result run(Scop &S, ScopAnalysisManager &SAM, ScopStandardAnalysisResults &SAR)
static AnalysisKey Key
PreservedAnalyses run(Scop &S, ScopAnalysisManager &, ScopStandardAnalysisResults &, SPMUpdater &)
__isl_null isl_union_map * isl_union_map_free(__isl_take isl_union_map *umap)
__isl_export __isl_give isl_space * isl_union_map_get_space(__isl_keep isl_union_map *umap)
__isl_export __isl_give isl_union_map * isl_union_map_reverse(__isl_take isl_union_map *umap)
__isl_give isl_union_map * isl_union_map_add_map(__isl_take isl_union_map *umap, __isl_take isl_map *map)
__isl_give isl_map * isl_map_from_union_map(__isl_take isl_union_map *umap)
__isl_export __isl_give isl_union_set * isl_union_map_deltas(__isl_take isl_union_map *umap)
__isl_export __isl_give isl_union_map * isl_union_set_identity(__isl_take isl_union_set *uset)
__isl_export __isl_give isl_union_map * isl_union_map_coalesce(__isl_take isl_union_map *umap)
__isl_export __isl_give isl_union_pw_multi_aff * isl_union_map_domain_map_union_pw_multi_aff(__isl_take isl_union_map *umap)
__isl_export __isl_give isl_union_map * isl_union_map_apply_range(__isl_take isl_union_map *umap1, __isl_take isl_union_map *umap2)
__isl_give isl_union_map * isl_union_map_copy(__isl_keep isl_union_map *umap)
__isl_export __isl_give isl_union_map * isl_union_map_subtract(__isl_take isl_union_map *umap1, __isl_take isl_union_map *umap2)
__isl_export isl_bool isl_union_map_is_empty(__isl_keep isl_union_map *umap)
__isl_export __isl_give isl_union_map * isl_union_map_apply_domain(__isl_take isl_union_map *umap1, __isl_take isl_union_map *umap2)
__isl_give isl_union_map * isl_union_map_empty(__isl_take isl_space *space)
__isl_export isl_bool isl_union_map_is_equal(__isl_keep isl_union_map *umap1, __isl_keep isl_union_map *umap2)
__isl_export __isl_give isl_union_map * isl_union_map_union(__isl_take isl_union_map *umap1, __isl_take isl_union_map *umap2)
__isl_give isl_union_map * isl_union_map_intersect_domain(__isl_take isl_union_map *umap, __isl_take isl_union_set *uset)
__isl_export __isl_give isl_union_map * isl_union_map_zip(__isl_take isl_union_map *umap)
__isl_give isl_union_map * isl_union_map_transitive_closure(__isl_take isl_union_map *umap, isl_bool *exact)
__isl_export __isl_give isl_union_map * isl_union_set_unwrap(__isl_take isl_union_set *uset)
__isl_export __isl_give isl_union_set * isl_union_map_domain(__isl_take isl_union_map *umap)
__isl_export __isl_give isl_union_map * isl_union_map_intersect_params(__isl_take isl_union_map *umap, __isl_take isl_set *set)
__isl_export __isl_give isl_union_map * isl_union_map_intersect(__isl_take isl_union_map *umap1, __isl_take isl_union_map *umap2)
struct isl_union_set isl_union_set
__isl_export __isl_give isl_union_set * isl_union_set_universe(__isl_take isl_union_set *uset)
__isl_give isl_union_set * isl_union_set_empty(__isl_take isl_space *space)
__isl_export __isl_give isl_space * isl_union_set_get_space(__isl_keep isl_union_set *uset)
__isl_constructor __isl_give isl_union_set * isl_union_set_from_set(__isl_take isl_set *set)
__isl_give isl_union_map * isl_union_set_lex_le_union_set(__isl_take isl_union_set *uset1, __isl_take isl_union_set *uset2)
__isl_give isl_union_set * isl_union_set_copy(__isl_keep isl_union_set *uset)
__isl_null isl_union_set * isl_union_set_free(__isl_take isl_union_set *uset)