Skip to content

Commit

Permalink
The TapirToTarget pass should invalidate analyses in more cases.
Browse files Browse the repository at this point in the history
The compiler crashed compiling cilkscale because the deleted call
to the tapir_frame intrinsic was still registered in the alias
analysis information.
  • Loading branch information
VoxSciurorum committed Oct 28, 2023
1 parent 9c9a278 commit 0ae760f
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions llvm/lib/Transforms/Tapir/TapirToTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,20 +414,22 @@ bool TapirToTargetImpl::processFunction(
splitTaskFrameCreateBlocks(F, &OA.DT, &TI);
TI.findTaskFrameTree();

bool ChangedCFG = false;
bool Changed = false;
{
NamedRegionTimer NRT("TargetPreProcess", "Target preprocessing",
TimerGroupName, TimerGroupDescription,
TimePassesIsEnabled);
ChangedCFG = Target->preProcessFunction(F, TI);
Changed = Target->preProcessFunction(F, TI);
} // end timed region

// If we don't need to do outlining, then just handle the simple ABI.
if (!Target->shouldDoOutlining(F)) {
// Process the Tapir instructions in F directly.
if (!Target->processOrdinaryFunction(F, &F.getEntryBlock()))
processSimpleABI(F, &F.getEntryBlock());
return ChangedCFG;
if (Target->processOrdinaryFunction(F, &F.getEntryBlock()))
return true;
if (processSimpleABI(F, &F.getEntryBlock()))
return true;
return Changed;
}

// Traverse the tasks in this function in post order.
Expand All @@ -449,17 +451,19 @@ bool TapirToTargetImpl::processFunction(
// helpers.
for (Spindle *TF : AllTaskFrames) {
if (isSpawningTaskFrame(TF) && !isSpawnedTaskFrame(TF))
processSpawnerTaskFrame(TF, TFToOutline, OA, TI);
Changed |= processSpawnerTaskFrame(TF, TFToOutline, OA, TI);
else if (isSpawnedTaskFrame(TF))
processOutlinedTask(TF->getTaskFromTaskFrame(), TFToOutline, OA, TI);
Changed |= processOutlinedTask(TF->getTaskFromTaskFrame(),
TFToOutline, OA, TI);
else
if (!Target->processOrdinaryFunction(*TFToOutline[TF].Outline,
TF->getEntry()))
processSimpleABI(*TFToOutline[TF].Outline, TF->getEntry());
Changed |=
(Target->processOrdinaryFunction(*TFToOutline[TF].Outline,
TF->getEntry()) ||
processSimpleABI(*TFToOutline[TF].Outline, TF->getEntry()));
NewHelpers.push_back(TFToOutline[TF].Outline);
}
// Process the root task
processRootTask(F, TFToOutline, OA, TI);
Changed |= processRootTask(F, TFToOutline, OA, TI);

{
NamedRegionTimer NRT("TargetPostProcess", "Target postprocessing",
Expand All @@ -485,7 +489,7 @@ bool TapirToTargetImpl::processFunction(
}
});

return ChangedCFG || !NewHelpers.empty();
return Changed || !NewHelpers.empty();
}

bool TapirToTargetImpl::run() {
Expand Down

0 comments on commit 0ae760f

Please sign in to comment.