@@ -1816,11 +1816,10 @@ static Value *emitTaskDependencies(
18161816 return DepArray;
18171817}
18181818
1819- OpenMPIRBuilder::InsertPointOrErrorTy
1820- OpenMPIRBuilder::createTask (const LocationDescription &Loc,
1821- InsertPointTy AllocaIP, BodyGenCallbackTy BodyGenCB,
1822- bool Tied, Value *Final, Value *IfCondition,
1823- SmallVector<DependData> Dependencies) {
1819+ OpenMPIRBuilder::InsertPointOrErrorTy OpenMPIRBuilder::createTask (
1820+ const LocationDescription &Loc, InsertPointTy AllocaIP,
1821+ BodyGenCallbackTy BodyGenCB, bool Tied, Value *Final, Value *IfCondition,
1822+ SmallVector<DependData> Dependencies, bool Mergeable) {
18241823
18251824 if (!updateToLocation (Loc))
18261825 return InsertPointTy ();
@@ -1866,7 +1865,8 @@ OpenMPIRBuilder::createTask(const LocationDescription &Loc,
18661865 Builder, AllocaIP, ToBeDeleted, TaskAllocaIP, " global.tid" , false ));
18671866
18681867 OI.PostOutlineCB = [this , Ident, Tied, Final, IfCondition, Dependencies,
1869- TaskAllocaBB, ToBeDeleted](Function &OutlinedFn) mutable {
1868+ Mergeable, TaskAllocaBB,
1869+ ToBeDeleted](Function &OutlinedFn) mutable {
18701870 // Replace the Stale CI by appropriate RTL function call.
18711871 assert (OutlinedFn.getNumUses () == 1 &&
18721872 " there must be a single user for the outlined function" );
@@ -1891,6 +1891,8 @@ OpenMPIRBuilder::createTask(const LocationDescription &Loc,
18911891 // Task is untied iff (Flags & 1) == 0.
18921892 // Task is final iff (Flags & 2) == 2.
18931893 // Task is not final iff (Flags & 2) == 0.
1894+ // Task is mergeable iff (Flags & 4) == 4.
1895+ // Task is not mergeable iff (Flags & 4) == 0.
18941896 // TODO: Handle the other flags.
18951897 Value *Flags = Builder.getInt32 (Tied);
18961898 if (Final) {
@@ -1899,6 +1901,9 @@ OpenMPIRBuilder::createTask(const LocationDescription &Loc,
18991901 Flags = Builder.CreateOr (FinalFlag, Flags);
19001902 }
19011903
1904+ if (Mergeable)
1905+ Flags = Builder.CreateOr (Builder.getInt32 (4 ), Flags);
1906+
19021907 // Argument - `sizeof_kmp_task_t` (TaskSize)
19031908 // Tasksize refers to the size in bytes of kmp_task_t data structure
19041909 // including private vars accessed in task.
0 commit comments