Dependences: Exit early, if no reduction dependences are needed.

In case we do not compute reduction dependences or dependences that are more
fine-grained than statement level dependences, we can avoid the corresponding
part of the dependence analysis all together. For the 3mm benchmark, this
reduces scheduling + dependence analysis time from 62ms to 33ms for a no-asserts
build.  The majority of the compile time is anyhow spent in the LLVM backends,
when doing code generation. Nevertheless, there is no need to waste compile time
either.

llvm-svn: 280557
This commit is contained in:
Tobias Grosser 2016-09-02 23:29:38 +00:00
parent f4903a3675
commit dff5de2e44
1 changed files with 12 additions and 1 deletions

View File

@ -335,13 +335,15 @@ void Dependences::calculateDependences(Scop &S) {
collectInfo(S, &Read, &Write, &MayWrite, &AccessSchedule, &StmtSchedule,
Level);
bool HasReductions = !isl_union_map_is_empty(AccessSchedule);
DEBUG(dbgs() << "Read: " << Read << '\n';
dbgs() << "Write: " << Write << '\n';
dbgs() << "MayWrite: " << MayWrite << '\n';
dbgs() << "AccessSchedule: " << AccessSchedule << '\n';
dbgs() << "StmtSchedule: " << StmtSchedule << '\n';);
if (isl_union_map_is_empty(AccessSchedule)) {
if (!HasReductions) {
isl_union_map_free(AccessSchedule);
Schedule = S.getScheduleTree();
// Tag the schedule tree if we want fine-grain dependence info
@ -444,6 +446,15 @@ void Dependences::calculateDependences(Scop &S) {
isl_ctx_reset_operations(IslCtx.get());
isl_ctx_set_max_operations(IslCtx.get(), MaxOpsOld);
// Drop out early, as the remaining computations are only needed for
// reduction dependences or dependences that are finer than statement
// level dependences.
if (!HasReductions && Level == AL_Statement) {
TC_RED = isl_union_map_empty(isl_union_map_get_space(StmtSchedule));
isl_union_map_free(StmtSchedule);
return;
}
isl_union_map *STMT_RAW, *STMT_WAW, *STMT_WAR;
STMT_RAW = isl_union_map_intersect_domain(
isl_union_map_copy(RAW),