================ @@ -2979,39 +2979,61 @@ static int getMapDataMemberIdx(MapInfoData &mapData, omp::MapInfoOp memberOp) { return std::distance(mapData.MapClause.begin(), res); } -static omp::MapInfoOp getFirstOrLastMappedMemberPtr(omp::MapInfoOp mapInfo, - bool first) { - ArrayAttr indexAttr = mapInfo.getMembersIndexAttr(); - // Only 1 member has been mapped, we can return it. - if (indexAttr.size() == 1) - return cast<omp::MapInfoOp>(mapInfo.getMembers()[0].getDefiningOp()); +static void sortMapIndices(llvm::SmallVector<size_t> &indices, + mlir::omp::MapInfoOp mapInfo, + bool ascending = true) { ---------------- skatrak wrote:
It seems a bit overkill to introduce this argument and allow sorting the list in reverse order just so that we can get the first or the last element in `getFirstOrLastMappedMemberPtr`. Wouldn't it be simpler to just update the `mapInfo.getMembers()[indices.front()].getDefiningOp());` expression to take `indices.front()` or `indices.back()` based on the `first` argument? https://github.com/llvm/llvm-project/pull/119588 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits