Skip to content

Commit

Permalink
[TaskSimplfy] Add debugging output that clarifies why taskframes are …
Browse files Browse the repository at this point in the history
…not removed.
  • Loading branch information
neboat committed Sep 5, 2024
1 parent dfd2839 commit 220b52a
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions llvm/lib/Transforms/Utils/TaskSimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,15 @@ static bool canRemoveTaskFrame(const Spindle *TF, MaybeParallelTasks &MPTasks,
// properties. We do not need to check the task that uses this taskframe.
const Task *UserT = TF->getTaskFromTaskFrame();

if (!UserT && !MPTasks.TaskList[TF].empty() && getTaskFrameResume(TFCreate))
if (!UserT && !MPTasks.TaskList[TF].empty() && getTaskFrameResume(TFCreate)) {
// Landingpads perform an implicit sync, so if there are logically parallel
// tasks with this unassociated taskframe and it has a resume destination,
// then it has a distinguishing sync.
LLVM_DEBUG(
dbgs() << "Can't remove taskframe with implicit distinguishing sync: "
<< *TFCreate << "\n");
return false;
}

// Create filter for MPTasks of tasks from parent of task UserT, if UserT
// exists.
Expand Down Expand Up @@ -324,17 +328,26 @@ static bool canRemoveTaskFrame(const Spindle *TF, MaybeParallelTasks &MPTasks,
for (const Instruction &I : *BB) {
if (isa<AllocaInst>(I)) {
TaskFrameContainsAlloca = true;
if (UserT)
if (UserT) {
LLVM_DEBUG(
dbgs()
<< "Can't remove taskframe with allocas used by spawned task: "
<< *TFCreate << "\n");
return false;
}
}
}

// We cannot remove taskframes that contain discriminating syncs. Doing
// so would cause these syncs to sync tasks spawned in the parent
// taskframe.
if (const SyncInst *SI = dyn_cast<SyncInst>(BB->getTerminator()))
if (syncIsDiscriminating(SI->getSyncRegion(), LocalTaskList))
if (syncIsDiscriminating(SI->getSyncRegion(), LocalTaskList)) {
LLVM_DEBUG(dbgs()
<< "Can't remove taskframe with distinguishing sync: "
<< *TFCreate << "\n");
return false;
}
}
}

Expand Down

0 comments on commit 220b52a

Please sign in to comment.