@@ -353,19 +353,29 @@ namespace {
353
353
354
354
using namespace tc ::polyhedral;
355
355
356
+ // Compute the dependence using the given may/must sources, sinks and kills.
357
+ // Any of the inputs may be an empty (but non-null) union map.
358
+ // Dependence analysis removes the cases transitively covered by a must source
359
+ // or a kill.
356
360
isl::union_map computeDependences (
357
- isl::union_map sources,
361
+ isl::union_map maySources,
362
+ isl::union_map mustSources,
358
363
isl::union_map sinks,
364
+ isl::union_map kills,
359
365
isl::schedule schedule) {
360
366
auto uai = isl::union_access_info (sinks);
361
- uai = uai.set_may_source (sources);
367
+ uai = uai.set_may_source (maySources);
368
+ uai = uai.set_must_source (mustSources);
369
+ uai = uai.set_kill (kills);
362
370
uai = uai.set_schedule (schedule);
363
371
auto flow = uai.compute_flow ();
364
372
return flow.get_may_dependence ();
365
373
}
366
374
367
- // Do the simplest possible dependence analysis.
368
- // Live-range reordering needs tagged access relations to be available.
375
+ // Set up schedule constraints by performing the dependence analysis using
376
+ // access relations from "scop". Set up callbacks in the constraints depending
377
+ // on "scheduleOptions".
378
+ //
369
379
// The domain of the constraints is intersected with "restrictDomain" if it is
370
380
// provided.
371
381
isl::schedule_constraints makeScheduleConstraints (
@@ -375,12 +385,16 @@ isl::schedule_constraints makeScheduleConstraints(
375
385
auto schedule = toIslSchedule (scop.scheduleRoot ());
376
386
auto firstChildNode = scop.scheduleRoot ()->child ({0 });
377
387
auto reads = scop.reads .domain_factor_domain ();
378
- auto writes = scop.mayWrites .domain_factor_domain ();
388
+ auto mayWrites = scop.mayWrites .domain_factor_domain ();
389
+ auto mustWrites = scop.mustWrites .domain_factor_domain ();
390
+ auto empty = isl::union_map::empty (mustWrites.get_space ());
379
391
380
392
// RAW
381
- auto flowDeps = computeDependences (writes, reads, schedule);
393
+ auto flowDeps =
394
+ computeDependences (mayWrites, mustWrites, reads, mustWrites, schedule);
382
395
// WAR and WAW
383
- auto falseDeps = computeDependences (writes.unite (reads), writes, schedule);
396
+ auto falseDeps = computeDependences (
397
+ mayWrites.unite (reads), empty, mayWrites, mustWrites, schedule);
384
398
385
399
auto allDeps = flowDeps.unite (falseDeps).coalesce ();
386
400
0 commit comments