diff --git a/llvm/lib/Transforms/Tapir/TapirToTarget.cpp b/llvm/lib/Transforms/Tapir/TapirToTarget.cpp index a364bb298f96..27dfb416a336 100644 --- a/llvm/lib/Transforms/Tapir/TapirToTarget.cpp +++ b/llvm/lib/Transforms/Tapir/TapirToTarget.cpp @@ -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. @@ -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", @@ -485,7 +489,7 @@ bool TapirToTargetImpl::processFunction( } }); - return ChangedCFG || !NewHelpers.empty(); + return Changed || !NewHelpers.empty(); } bool TapirToTargetImpl::run() {