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