[llvm-branch-commits] [llvm] release/18.x: [DAGCombiner] Fix miscompile bug in combineShiftOfShiftedLogic (#89616) (PR #89766)
bjope wrote: > @bjope What do you think about backporting this? Thanks! That looks/sounds good to me. (The fault was found when using "-fsanitize=undefined -O0" so it was not as if we were using fuzzy pass pipelines etc to trigger the bug. I guess the special thing was the use of larger BitInt types being used in the test,. Combining two 128-bit shifts would't result in a combined shift amount larger than 255, so larger types than 128 bits would be needed to expose the problem.) https://github.com/llvm/llvm-project/pull/89766 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/18.x: [TableGen] Fix ReplaceRegAction RTTI Kind (PR #89790)
Pierre-vh wrote: We don't use RTTI of that class before #89736 so unless that's also being backported for some reason it's not needed. https://github.com/llvm/llvm-project/pull/89790 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] release/18.x: [libcxx] [modules] Add _LIBCPP_USING_IF_EXISTS on aligned_alloc (#89827) (PR #89894)
https://github.com/llvmbot created https://github.com/llvm/llvm-project/pull/89894 Backport 91526d64a8adb14edc55adfd5270858791822837 Requested by: @mstorsjo >From 7fc76537bb8097ab98abe0b83479d4aeff36b28c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 24 Apr 2024 11:45:27 +0300 Subject: [PATCH] =?UTF-8?q?[libcxx]=20[modules]=C2=A0Add=20=5FLIBCPP=5FUSI?= =?UTF-8?q?NG=5FIF=5FEXISTS=20on=20aligned=5Falloc=20(#89827)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is missing e.g. on Windows. With this change, it's possible to make the libcxx std module work on mingw-w64 (although that requires a few fixes to those headers). In the regular cstdlib header, we have _LIBCPP_USING_IF_EXISTS flagged on every single reexported function (since a9c9183ca42629fa83cdda297d1d30c7bc1d7c91), but the modules seem to only have _LIBCPP_USING_IF_EXISTS set on a few individual functions, so far. (cherry picked from commit 91526d64a8adb14edc55adfd5270858791822837) --- libcxx/modules/std.compat/cstdlib.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcxx/modules/std.compat/cstdlib.inc b/libcxx/modules/std.compat/cstdlib.inc index a45a0a1caf8ba9..4783cbf5162390 100644 --- a/libcxx/modules/std.compat/cstdlib.inc +++ b/libcxx/modules/std.compat/cstdlib.inc @@ -25,7 +25,7 @@ export { using ::system; // [c.malloc], C library memory allocation - using ::aligned_alloc; + using ::aligned_alloc _LIBCPP_USING_IF_EXISTS; using ::calloc; using ::free; using ::malloc; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] release/18.x: [libcxx] [modules] Add _LIBCPP_USING_IF_EXISTS on aligned_alloc (#89827) (PR #89894)
https://github.com/llvmbot milestoned https://github.com/llvm/llvm-project/pull/89894 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] release/18.x: [libcxx] [modules] Add _LIBCPP_USING_IF_EXISTS on aligned_alloc (#89827) (PR #89894)
llvmbot wrote: @mordante What do you think about merging this PR to the release branch? https://github.com/llvm/llvm-project/pull/89894 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] release/18.x: [libcxx] [modules] Add _LIBCPP_USING_IF_EXISTS on aligned_alloc (#89827) (PR #89894)
llvmbot wrote: @llvm/pr-subscribers-libcxx Author: None (llvmbot) Changes Backport 91526d64a8adb14edc55adfd5270858791822837 Requested by: @mstorsjo --- Full diff: https://github.com/llvm/llvm-project/pull/89894.diff 1 Files Affected: - (modified) libcxx/modules/std.compat/cstdlib.inc (+1-1) ``diff diff --git a/libcxx/modules/std.compat/cstdlib.inc b/libcxx/modules/std.compat/cstdlib.inc index a45a0a1caf8ba9..4783cbf5162390 100644 --- a/libcxx/modules/std.compat/cstdlib.inc +++ b/libcxx/modules/std.compat/cstdlib.inc @@ -25,7 +25,7 @@ export { using ::system; // [c.malloc], C library memory allocation - using ::aligned_alloc; + using ::aligned_alloc _LIBCPP_USING_IF_EXISTS; using ::calloc; using ::free; using ::malloc; `` https://github.com/llvm/llvm-project/pull/89894 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)
@@ -2081,6 +2083,79 @@ void collectMapDataFromMapOperands(MapInfoData &mapData, } } +static int getMapDataMemberIdx(MapInfoData &mapData, + mlir::omp::MapInfoOp memberOp) { + auto *res = llvm::find(mapData.MapClause, memberOp); + assert(res != mapData.MapClause.end()); + return std::distance(mapData.MapClause.begin(), res); +} + +static mlir::omp::MapInfoOp +getFirstOrLastMappedMemberPtr(mlir::omp::MapInfoOp mapInfo, bool first) { + // Only 1 member has been mapped, we can return it. + if (mapInfo.getMembersIndex()->size() == 1) +if (auto mapOp = mlir::dyn_cast( +mapInfo.getMembers()[0].getDefiningOp())) + return mapOp; + + std::vector indices( + mapInfo.getMembersIndexAttr().getShapedType().getShape()[0]); + std::iota(indices.begin(), indices.end(), 0); skatrak wrote: Disregard this suggestion, it's not the same. Sorry about that! https://github.com/llvm/llvm-project/pull/82852 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/82852 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [mlir] [MLIR][OpenMP] Update op verifiers dependent on omp.wsloop (2/5) (PR #89211)
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/89211 >From f9b14e37a6f437768c405291c064f541f0655b1c Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Wed, 17 Apr 2024 16:40:03 +0100 Subject: [PATCH 1/2] [MLIR][OpenMP] Update op verifiers dependent on omp.wsloop (2/5) This patch updates verifiers for `omp.ordered.region`, `omp.cancel` and `omp.cancellation_point`, which check for a parent `omp.wsloop`. After transitioning to a loop wrapper-based approach, the expected direct parent will become `omp.loop_nest` instead, so verifiers need to take this into account. This PR on its own will not pass premerge tests. All patches in the stack are needed before it can be compiled and passes tests. --- mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp | 23 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp index d66186effc31d6..d014c27e1ee157 100644 --- a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp +++ b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp @@ -1977,9 +1977,10 @@ LogicalResult OrderedRegionOp::verify() { if (getSimd()) return failure(); - if (auto container = (*this)->getParentOfType()) { -if (!container.getOrderedValAttr() || -container.getOrderedValAttr().getInt() != 0) + if (auto loopOp = dyn_cast((*this)->getParentOp())) { +auto wsloopOp = llvm::dyn_cast_if_present(loopOp->getParentOp()); +if (!wsloopOp || !wsloopOp.getOrderedValAttr() || +wsloopOp.getOrderedValAttr().getInt() != 0) return emitOpError() << "ordered region must be closely nested inside " << "a worksharing-loop region with an ordered " << "clause without parameter present"; @@ -2130,15 +2131,19 @@ LogicalResult CancelOp::verify() { << "inside a parallel region"; } if (cct == ClauseCancellationConstructType::Loop) { -if (!isa(parentOp)) { - return emitOpError() << "cancel loop must appear " - << "inside a worksharing-loop region"; +auto loopOp = dyn_cast(parentOp); +auto wsloopOp = llvm::dyn_cast_if_present( +loopOp ? loopOp->getParentOp() : nullptr); + +if (!wsloopOp) { + return emitOpError() + << "cancel loop must appear inside a worksharing-loop region"; } -if (cast(parentOp).getNowaitAttr()) { +if (wsloopOp.getNowaitAttr()) { return emitError() << "A worksharing construct that is canceled " << "must not have a nowait clause"; } -if (cast(parentOp).getOrderedValAttr()) { +if (wsloopOp.getOrderedValAttr()) { return emitError() << "A worksharing construct that is canceled " << "must not have an ordered clause"; } @@ -2176,7 +2181,7 @@ LogicalResult CancellationPointOp::verify() { << "inside a parallel region"; } if ((cct == ClauseCancellationConstructType::Loop) && - !isa(parentOp)) { + (!isa(parentOp) || !isa(parentOp->getParentOp( { return emitOpError() << "cancellation point loop must appear " << "inside a worksharing-loop region"; } >From 18c8bda112d60824c74904d8c27a16f7f016c020 Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Fri, 19 Apr 2024 11:37:21 +0100 Subject: [PATCH 2/2] Address review comment, improve tests --- mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp | 57 +++-- mlir/test/Dialect/OpenMP/invalid.mlir| 67 2 files changed, 94 insertions(+), 30 deletions(-) diff --git a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp index d014c27e1ee157..c546d3a9044de1 100644 --- a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp +++ b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp @@ -1945,6 +1945,39 @@ LogicalResult CriticalOp::verifySymbolUses(SymbolTableCollection &symbolTable) { // Ordered construct //===--===// +static LogicalResult verifyOrderedParent(Operation &op) { + bool hasRegion = op.getNumRegions() > 0; + auto loopOp = op.getParentOfType(); + if (!loopOp) { +if (hasRegion) + return success(); + +// TODO: Consider if this needs to be the case only for the standalone +// variant of the ordered construct. +return op.emitOpError() << "must be nested inside of a loop"; + } + + Operation *wrapper = loopOp->getParentOp(); + if (auto wsloopOp = dyn_cast(wrapper)) { +IntegerAttr orderedAttr = wsloopOp.getOrderedValAttr(); +if (!orderedAttr) + return op.emitOpError() << "the enclosing worksharing-loop region must " + "have an ordered clause"; + +if (hasRegion && orderedAttr.getInt() != 0) + return op.emitOpError() << "the enclosing loop's ordered clause must not
[llvm-branch-commits] [mlir] [MLIR][SCF] Update scf.parallel lowering to OpenMP (3/5) (PR #89212)
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/89212 >From fdee8cf17cd7d2dbdb6cf872574776f02e70be7c Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Thu, 18 Apr 2024 10:55:16 +0100 Subject: [PATCH 1/2] [MLIR][SCF] Update scf.parallel lowering to OpenMP (3/5) This patch makes changes to the `scf.parallel` to `omp.parallel` + `omp.wsloop` lowering pass in order to introduce a nested `omp.loop_nest` as well, and to follow the new loop wrapper role for `omp.wsloop`. This PR on its own will not pass premerge tests. All patches in the stack are needed before it can be compiled and passes tests. --- .../Conversion/SCFToOpenMP/SCFToOpenMP.cpp| 52 ++- .../Conversion/SCFToOpenMP/reductions.mlir| 5 ++ .../Conversion/SCFToOpenMP/scf-to-openmp.mlir | 31 --- 3 files changed, 68 insertions(+), 20 deletions(-) diff --git a/mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp b/mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp index 7f91367ad427a2..f0b8d6c5309357 100644 --- a/mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp +++ b/mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp @@ -461,18 +461,51 @@ struct ParallelOpLowering : public OpRewritePattern { // Replace the loop. { OpBuilder::InsertionGuard allocaGuard(rewriter); -auto loop = rewriter.create( +// Create worksharing loop wrapper. +auto wsloopOp = rewriter.create(parallelOp.getLoc()); +if (!reductionVariables.empty()) { + wsloopOp.setReductionsAttr( + ArrayAttr::get(rewriter.getContext(), reductionDeclSymbols)); + wsloopOp.getReductionVarsMutable().append(reductionVariables); +} +rewriter.create(loc); // omp.parallel terminator. + +// The wrapper's entry block arguments will define the reduction +// variables. +llvm::SmallVector reductionTypes; +reductionTypes.reserve(reductionVariables.size()); +llvm::transform(reductionVariables, std::back_inserter(reductionTypes), +[](mlir::Value v) { return v.getType(); }); +rewriter.createBlock( +&wsloopOp.getRegion(), {}, reductionTypes, +llvm::SmallVector(reductionVariables.size(), + parallelOp.getLoc())); + +rewriter.setInsertionPoint( +rewriter.create(parallelOp.getLoc())); + +// Create loop nest and populate region with contents of scf.parallel. +auto loopOp = rewriter.create( parallelOp.getLoc(), parallelOp.getLowerBound(), parallelOp.getUpperBound(), parallelOp.getStep()); -rewriter.create(loc); -rewriter.inlineRegionBefore(parallelOp.getRegion(), loop.getRegion(), -loop.getRegion().begin()); +rewriter.inlineRegionBefore(parallelOp.getRegion(), loopOp.getRegion(), +loopOp.getRegion().begin()); + +// Remove reduction-related block arguments from omp.loop_nest and +// redirect uses to the corresponding omp.wsloop block argument. +mlir::Block &loopOpEntryBlock = loopOp.getRegion().front(); +unsigned numLoops = parallelOp.getNumLoops(); +rewriter.replaceAllUsesWith( +loopOpEntryBlock.getArguments().drop_front(numLoops), +wsloopOp.getRegion().getArguments()); +loopOpEntryBlock.eraseArguments( +numLoops, loopOpEntryBlock.getNumArguments() - numLoops); -Block *ops = rewriter.splitBlock(&*loop.getRegion().begin(), - loop.getRegion().begin()->begin()); +Block *ops = rewriter.splitBlock(&*loopOp.getRegion().begin(), + loopOp.getRegion().begin()->begin()); -rewriter.setInsertionPointToStart(&*loop.getRegion().begin()); +rewriter.setInsertionPointToStart(&*loopOp.getRegion().begin()); auto scope = rewriter.create(parallelOp.getLoc(), TypeRange()); @@ -481,11 +514,6 @@ struct ParallelOpLowering : public OpRewritePattern { rewriter.mergeBlocks(ops, scopeBlock); rewriter.setInsertionPointToEnd(&*scope.getBodyRegion().begin()); rewriter.create(loc, ValueRange()); -if (!reductionVariables.empty()) { - loop.setReductionsAttr( - ArrayAttr::get(rewriter.getContext(), reductionDeclSymbols)); - loop.getReductionVarsMutable().append(reductionVariables); -} } } diff --git a/mlir/test/Conversion/SCFToOpenMP/reductions.mlir b/mlir/test/Conversion/SCFToOpenMP/reductions.mlir index 3b6c145d62f1a8..fc6d56559c2618 100644 --- a/mlir/test/Conversion/SCFToOpenMP/reductions.mlir +++ b/mlir/test/Conversion/SCFToOpenMP/reductions.mlir @@ -28,6 +28,7 @@ func.func @reduction1(%arg0 : index, %arg1 : index, %arg2 : index, // CHECK: omp.
[llvm-branch-commits] [mlir] [MLIR][OpenMP] Update omp.wsloop translation to LLVM IR (4/5) (PR #89214)
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/89214 >From 25dc3a45645ab2310606b2ab02346eed700c7f97 Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Thu, 18 Apr 2024 11:07:10 +0100 Subject: [PATCH] [MLIR][OpenMP] Update omp.wsloop translation to LLVM IR (4/5) This patch introduces minimal changes to the MLIR to LLVM IR translation of omp.wsloop to support the loop wrapper approach. There is `omp.loop_nest` related translation code that should be extracted and shared among all loop operations (e.g. `omp.simd`). This would possibly also help in the addition of support for compound constructs later on. This first approach is only intended to keep things running after the transition to loop wrappers and not to add support for other use cases enabled by that transition. This PR on its own will not pass premerge tests. All patches in the stack are needed before it can be compiled and passes tests. --- .../OpenMP/OpenMPToLLVMIRTranslation.cpp | 68 +- .../LLVMIR/omptarget-parallel-wsloop.mlir | 11 +- .../LLVMIR/omptarget-wsloop-collapsed.mlir| 17 +- mlir/test/Target/LLVMIR/omptarget-wsloop.mlir | 18 +- .../LLVMIR/openmp-data-target-device.mlir | 31 +- mlir/test/Target/LLVMIR/openmp-llvm.mlir | 741 ++ mlir/test/Target/LLVMIR/openmp-nested.mlir| 30 +- mlir/test/Target/LLVMIR/openmp-reduction.mlir | 113 +-- .../openmp-wsloop-reduction-cleanup.mlir | 9 +- 9 files changed, 572 insertions(+), 466 deletions(-) diff --git a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp index e89ff9209b034a..22d6462b881dc0 100644 --- a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp +++ b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp @@ -916,35 +916,37 @@ static LogicalResult inlineReductionCleanup( static LogicalResult convertOmpWsloop(Operation &opInst, llvm::IRBuilderBase &builder, LLVM::ModuleTranslation &moduleTranslation) { - auto loop = cast(opInst); - const bool isByRef = loop.getByref(); + auto wsloopOp = cast(opInst); + auto loopOp = cast(wsloopOp.getWrappedLoop()); + const bool isByRef = wsloopOp.getByref(); + // TODO: this should be in the op verifier instead. - if (loop.getLowerBound().empty()) + if (loopOp.getLowerBound().empty()) return failure(); // Static is the default. auto schedule = - loop.getScheduleVal().value_or(omp::ClauseScheduleKind::Static); + wsloopOp.getScheduleVal().value_or(omp::ClauseScheduleKind::Static); // Find the loop configuration. - llvm::Value *step = moduleTranslation.lookupValue(loop.getStep()[0]); + llvm::Value *step = moduleTranslation.lookupValue(loopOp.getStep()[0]); llvm::Type *ivType = step->getType(); llvm::Value *chunk = nullptr; - if (loop.getScheduleChunkVar()) { + if (wsloopOp.getScheduleChunkVar()) { llvm::Value *chunkVar = -moduleTranslation.lookupValue(loop.getScheduleChunkVar()); +moduleTranslation.lookupValue(wsloopOp.getScheduleChunkVar()); chunk = builder.CreateSExtOrTrunc(chunkVar, ivType); } SmallVector reductionDecls; - collectReductionDecls(loop, reductionDecls); + collectReductionDecls(wsloopOp, reductionDecls); llvm::OpenMPIRBuilder::InsertPointTy allocaIP = findAllocaInsertPoint(builder, moduleTranslation); SmallVector privateReductionVariables; DenseMap reductionVariableMap; if (!isByRef) { -allocByValReductionVars(loop, builder, moduleTranslation, allocaIP, +allocByValReductionVars(wsloopOp, builder, moduleTranslation, allocaIP, reductionDecls, privateReductionVariables, reductionVariableMap); } @@ -952,13 +954,12 @@ convertOmpWsloop(Operation &opInst, llvm::IRBuilderBase &builder, // Before the loop, store the initial values of reductions into reduction // variables. Although this could be done after allocas, we don't want to mess // up with the alloca insertion point. - MutableArrayRef reductionArgs = - loop.getRegion().getArguments().take_back(loop.getNumReductionVars()); - for (unsigned i = 0; i < loop.getNumReductionVars(); ++i) { + ArrayRef reductionArgs = wsloopOp.getRegion().getArguments(); + for (unsigned i = 0; i < wsloopOp.getNumReductionVars(); ++i) { SmallVector phis; // map block argument to initializer region -mapInitializationArg(loop, moduleTranslation, reductionDecls, i); +mapInitializationArg(wsloopOp, moduleTranslation, reductionDecls, i); if (failed(inlineConvertOmpRegions(reductionDecls[i].getInitializerRegion(), "omp.reduction.neutral", builder, @@ -977,7 +978,7 @@ convertOmpWsloop(Operation &opInst, llvm::IRBuilderBase &builder, privateReductionVariables.push_back(var); moduleTranslation.mapValue(reductionArgs[i], phi
[llvm-branch-commits] [mlir] [MLIR][OpenMP] Update op verifiers dependent on omp.wsloop (2/5) (PR #89211)
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/89211 >From f9b14e37a6f437768c405291c064f541f0655b1c Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Wed, 17 Apr 2024 16:40:03 +0100 Subject: [PATCH 1/2] [MLIR][OpenMP] Update op verifiers dependent on omp.wsloop (2/5) This patch updates verifiers for `omp.ordered.region`, `omp.cancel` and `omp.cancellation_point`, which check for a parent `omp.wsloop`. After transitioning to a loop wrapper-based approach, the expected direct parent will become `omp.loop_nest` instead, so verifiers need to take this into account. This PR on its own will not pass premerge tests. All patches in the stack are needed before it can be compiled and passes tests. --- mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp | 23 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp index d66186effc31d6..d014c27e1ee157 100644 --- a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp +++ b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp @@ -1977,9 +1977,10 @@ LogicalResult OrderedRegionOp::verify() { if (getSimd()) return failure(); - if (auto container = (*this)->getParentOfType()) { -if (!container.getOrderedValAttr() || -container.getOrderedValAttr().getInt() != 0) + if (auto loopOp = dyn_cast((*this)->getParentOp())) { +auto wsloopOp = llvm::dyn_cast_if_present(loopOp->getParentOp()); +if (!wsloopOp || !wsloopOp.getOrderedValAttr() || +wsloopOp.getOrderedValAttr().getInt() != 0) return emitOpError() << "ordered region must be closely nested inside " << "a worksharing-loop region with an ordered " << "clause without parameter present"; @@ -2130,15 +2131,19 @@ LogicalResult CancelOp::verify() { << "inside a parallel region"; } if (cct == ClauseCancellationConstructType::Loop) { -if (!isa(parentOp)) { - return emitOpError() << "cancel loop must appear " - << "inside a worksharing-loop region"; +auto loopOp = dyn_cast(parentOp); +auto wsloopOp = llvm::dyn_cast_if_present( +loopOp ? loopOp->getParentOp() : nullptr); + +if (!wsloopOp) { + return emitOpError() + << "cancel loop must appear inside a worksharing-loop region"; } -if (cast(parentOp).getNowaitAttr()) { +if (wsloopOp.getNowaitAttr()) { return emitError() << "A worksharing construct that is canceled " << "must not have a nowait clause"; } -if (cast(parentOp).getOrderedValAttr()) { +if (wsloopOp.getOrderedValAttr()) { return emitError() << "A worksharing construct that is canceled " << "must not have an ordered clause"; } @@ -2176,7 +2181,7 @@ LogicalResult CancellationPointOp::verify() { << "inside a parallel region"; } if ((cct == ClauseCancellationConstructType::Loop) && - !isa(parentOp)) { + (!isa(parentOp) || !isa(parentOp->getParentOp( { return emitOpError() << "cancellation point loop must appear " << "inside a worksharing-loop region"; } >From 18c8bda112d60824c74904d8c27a16f7f016c020 Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Fri, 19 Apr 2024 11:37:21 +0100 Subject: [PATCH 2/2] Address review comment, improve tests --- mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp | 57 +++-- mlir/test/Dialect/OpenMP/invalid.mlir| 67 2 files changed, 94 insertions(+), 30 deletions(-) diff --git a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp index d014c27e1ee157..c546d3a9044de1 100644 --- a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp +++ b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp @@ -1945,6 +1945,39 @@ LogicalResult CriticalOp::verifySymbolUses(SymbolTableCollection &symbolTable) { // Ordered construct //===--===// +static LogicalResult verifyOrderedParent(Operation &op) { + bool hasRegion = op.getNumRegions() > 0; + auto loopOp = op.getParentOfType(); + if (!loopOp) { +if (hasRegion) + return success(); + +// TODO: Consider if this needs to be the case only for the standalone +// variant of the ordered construct. +return op.emitOpError() << "must be nested inside of a loop"; + } + + Operation *wrapper = loopOp->getParentOp(); + if (auto wsloopOp = dyn_cast(wrapper)) { +IntegerAttr orderedAttr = wsloopOp.getOrderedValAttr(); +if (!orderedAttr) + return op.emitOpError() << "the enclosing worksharing-loop region must " + "have an ordered clause"; + +if (hasRegion && orderedAttr.getInt() != 0) + return op.emitOpError() << "the enclosing loop's ordered clause must not
[llvm-branch-commits] [mlir] [MLIR][SCF] Update scf.parallel lowering to OpenMP (3/5) (PR #89212)
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/89212 >From fdee8cf17cd7d2dbdb6cf872574776f02e70be7c Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Thu, 18 Apr 2024 10:55:16 +0100 Subject: [PATCH 1/2] [MLIR][SCF] Update scf.parallel lowering to OpenMP (3/5) This patch makes changes to the `scf.parallel` to `omp.parallel` + `omp.wsloop` lowering pass in order to introduce a nested `omp.loop_nest` as well, and to follow the new loop wrapper role for `omp.wsloop`. This PR on its own will not pass premerge tests. All patches in the stack are needed before it can be compiled and passes tests. --- .../Conversion/SCFToOpenMP/SCFToOpenMP.cpp| 52 ++- .../Conversion/SCFToOpenMP/reductions.mlir| 5 ++ .../Conversion/SCFToOpenMP/scf-to-openmp.mlir | 31 --- 3 files changed, 68 insertions(+), 20 deletions(-) diff --git a/mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp b/mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp index 7f91367ad427a2..f0b8d6c5309357 100644 --- a/mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp +++ b/mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp @@ -461,18 +461,51 @@ struct ParallelOpLowering : public OpRewritePattern { // Replace the loop. { OpBuilder::InsertionGuard allocaGuard(rewriter); -auto loop = rewriter.create( +// Create worksharing loop wrapper. +auto wsloopOp = rewriter.create(parallelOp.getLoc()); +if (!reductionVariables.empty()) { + wsloopOp.setReductionsAttr( + ArrayAttr::get(rewriter.getContext(), reductionDeclSymbols)); + wsloopOp.getReductionVarsMutable().append(reductionVariables); +} +rewriter.create(loc); // omp.parallel terminator. + +// The wrapper's entry block arguments will define the reduction +// variables. +llvm::SmallVector reductionTypes; +reductionTypes.reserve(reductionVariables.size()); +llvm::transform(reductionVariables, std::back_inserter(reductionTypes), +[](mlir::Value v) { return v.getType(); }); +rewriter.createBlock( +&wsloopOp.getRegion(), {}, reductionTypes, +llvm::SmallVector(reductionVariables.size(), + parallelOp.getLoc())); + +rewriter.setInsertionPoint( +rewriter.create(parallelOp.getLoc())); + +// Create loop nest and populate region with contents of scf.parallel. +auto loopOp = rewriter.create( parallelOp.getLoc(), parallelOp.getLowerBound(), parallelOp.getUpperBound(), parallelOp.getStep()); -rewriter.create(loc); -rewriter.inlineRegionBefore(parallelOp.getRegion(), loop.getRegion(), -loop.getRegion().begin()); +rewriter.inlineRegionBefore(parallelOp.getRegion(), loopOp.getRegion(), +loopOp.getRegion().begin()); + +// Remove reduction-related block arguments from omp.loop_nest and +// redirect uses to the corresponding omp.wsloop block argument. +mlir::Block &loopOpEntryBlock = loopOp.getRegion().front(); +unsigned numLoops = parallelOp.getNumLoops(); +rewriter.replaceAllUsesWith( +loopOpEntryBlock.getArguments().drop_front(numLoops), +wsloopOp.getRegion().getArguments()); +loopOpEntryBlock.eraseArguments( +numLoops, loopOpEntryBlock.getNumArguments() - numLoops); -Block *ops = rewriter.splitBlock(&*loop.getRegion().begin(), - loop.getRegion().begin()->begin()); +Block *ops = rewriter.splitBlock(&*loopOp.getRegion().begin(), + loopOp.getRegion().begin()->begin()); -rewriter.setInsertionPointToStart(&*loop.getRegion().begin()); +rewriter.setInsertionPointToStart(&*loopOp.getRegion().begin()); auto scope = rewriter.create(parallelOp.getLoc(), TypeRange()); @@ -481,11 +514,6 @@ struct ParallelOpLowering : public OpRewritePattern { rewriter.mergeBlocks(ops, scopeBlock); rewriter.setInsertionPointToEnd(&*scope.getBodyRegion().begin()); rewriter.create(loc, ValueRange()); -if (!reductionVariables.empty()) { - loop.setReductionsAttr( - ArrayAttr::get(rewriter.getContext(), reductionDeclSymbols)); - loop.getReductionVarsMutable().append(reductionVariables); -} } } diff --git a/mlir/test/Conversion/SCFToOpenMP/reductions.mlir b/mlir/test/Conversion/SCFToOpenMP/reductions.mlir index 3b6c145d62f1a8..fc6d56559c2618 100644 --- a/mlir/test/Conversion/SCFToOpenMP/reductions.mlir +++ b/mlir/test/Conversion/SCFToOpenMP/reductions.mlir @@ -28,6 +28,7 @@ func.func @reduction1(%arg0 : index, %arg1 : index, %arg2 : index, // CHECK: omp.
[llvm-branch-commits] [mlir] [MLIR][OpenMP] Update omp.wsloop translation to LLVM IR (4/5) (PR #89214)
https://github.com/skatrak updated https://github.com/llvm/llvm-project/pull/89214 >From 25dc3a45645ab2310606b2ab02346eed700c7f97 Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Thu, 18 Apr 2024 11:07:10 +0100 Subject: [PATCH] [MLIR][OpenMP] Update omp.wsloop translation to LLVM IR (4/5) This patch introduces minimal changes to the MLIR to LLVM IR translation of omp.wsloop to support the loop wrapper approach. There is `omp.loop_nest` related translation code that should be extracted and shared among all loop operations (e.g. `omp.simd`). This would possibly also help in the addition of support for compound constructs later on. This first approach is only intended to keep things running after the transition to loop wrappers and not to add support for other use cases enabled by that transition. This PR on its own will not pass premerge tests. All patches in the stack are needed before it can be compiled and passes tests. --- .../OpenMP/OpenMPToLLVMIRTranslation.cpp | 68 +- .../LLVMIR/omptarget-parallel-wsloop.mlir | 11 +- .../LLVMIR/omptarget-wsloop-collapsed.mlir| 17 +- mlir/test/Target/LLVMIR/omptarget-wsloop.mlir | 18 +- .../LLVMIR/openmp-data-target-device.mlir | 31 +- mlir/test/Target/LLVMIR/openmp-llvm.mlir | 741 ++ mlir/test/Target/LLVMIR/openmp-nested.mlir| 30 +- mlir/test/Target/LLVMIR/openmp-reduction.mlir | 113 +-- .../openmp-wsloop-reduction-cleanup.mlir | 9 +- 9 files changed, 572 insertions(+), 466 deletions(-) diff --git a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp index e89ff9209b034a..22d6462b881dc0 100644 --- a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp +++ b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp @@ -916,35 +916,37 @@ static LogicalResult inlineReductionCleanup( static LogicalResult convertOmpWsloop(Operation &opInst, llvm::IRBuilderBase &builder, LLVM::ModuleTranslation &moduleTranslation) { - auto loop = cast(opInst); - const bool isByRef = loop.getByref(); + auto wsloopOp = cast(opInst); + auto loopOp = cast(wsloopOp.getWrappedLoop()); + const bool isByRef = wsloopOp.getByref(); + // TODO: this should be in the op verifier instead. - if (loop.getLowerBound().empty()) + if (loopOp.getLowerBound().empty()) return failure(); // Static is the default. auto schedule = - loop.getScheduleVal().value_or(omp::ClauseScheduleKind::Static); + wsloopOp.getScheduleVal().value_or(omp::ClauseScheduleKind::Static); // Find the loop configuration. - llvm::Value *step = moduleTranslation.lookupValue(loop.getStep()[0]); + llvm::Value *step = moduleTranslation.lookupValue(loopOp.getStep()[0]); llvm::Type *ivType = step->getType(); llvm::Value *chunk = nullptr; - if (loop.getScheduleChunkVar()) { + if (wsloopOp.getScheduleChunkVar()) { llvm::Value *chunkVar = -moduleTranslation.lookupValue(loop.getScheduleChunkVar()); +moduleTranslation.lookupValue(wsloopOp.getScheduleChunkVar()); chunk = builder.CreateSExtOrTrunc(chunkVar, ivType); } SmallVector reductionDecls; - collectReductionDecls(loop, reductionDecls); + collectReductionDecls(wsloopOp, reductionDecls); llvm::OpenMPIRBuilder::InsertPointTy allocaIP = findAllocaInsertPoint(builder, moduleTranslation); SmallVector privateReductionVariables; DenseMap reductionVariableMap; if (!isByRef) { -allocByValReductionVars(loop, builder, moduleTranslation, allocaIP, +allocByValReductionVars(wsloopOp, builder, moduleTranslation, allocaIP, reductionDecls, privateReductionVariables, reductionVariableMap); } @@ -952,13 +954,12 @@ convertOmpWsloop(Operation &opInst, llvm::IRBuilderBase &builder, // Before the loop, store the initial values of reductions into reduction // variables. Although this could be done after allocas, we don't want to mess // up with the alloca insertion point. - MutableArrayRef reductionArgs = - loop.getRegion().getArguments().take_back(loop.getNumReductionVars()); - for (unsigned i = 0; i < loop.getNumReductionVars(); ++i) { + ArrayRef reductionArgs = wsloopOp.getRegion().getArguments(); + for (unsigned i = 0; i < wsloopOp.getNumReductionVars(); ++i) { SmallVector phis; // map block argument to initializer region -mapInitializationArg(loop, moduleTranslation, reductionDecls, i); +mapInitializationArg(wsloopOp, moduleTranslation, reductionDecls, i); if (failed(inlineConvertOmpRegions(reductionDecls[i].getInitializerRegion(), "omp.reduction.neutral", builder, @@ -977,7 +978,7 @@ convertOmpWsloop(Operation &opInst, llvm::IRBuilderBase &builder, privateReductionVariables.push_back(var); moduleTranslation.mapValue(reductionArgs[i], phi
[llvm-branch-commits] [llvm] [bolt] Revise IDE folder structure (PR #89742)
https://github.com/Meinersbur ready_for_review https://github.com/llvm/llvm-project/pull/89742 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang] Revise IDE folder structure (PR #89743)
https://github.com/Meinersbur ready_for_review https://github.com/llvm/llvm-project/pull/89743 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang] Revise IDE folder structure (PR #89743)
llvmbot wrote: @llvm/pr-subscribers-clang-analysis Author: Michael Kruse (Meinersbur) Changes Reviewers of #89153 suggested to break up the patch into per-subproject patches. This is the Clang part. See #89153 for the entire series and motivation. Update the folder titles for targets in the monorepository that have not seen taken care of for some time. These are the folders that targets are organized in Visual Studio and XCode (`set_property(TARGETPROPERTY FOLDER " ")`) when using the respective CMake's IDE generator. * Ensure that every target is in a folder * Use a folder hierarchy with each LLVM subproject as a top-level folder * Use consistent folder names between subprojects * When using target-creating functions from AddLLVM.cmake, automatically deduce the folder. This reduces the number of `set_property`/`set_target_property`, but are still necessary when `add_custom_target`, `add_executable`, `add_library`, etc. are used. A LLVM_SUBPROJECT_TITLE definition is used for that in each subproject's root CMakeLists.txt. --- Full diff: https://github.com/llvm/llvm-project/pull/89743.diff 13 Files Affected: - (modified) clang/CMakeLists.txt (+5-3) - (modified) clang/bindings/python/tests/CMakeLists.txt (+1-1) - (modified) clang/cmake/modules/AddClang.cmake (-3) - (modified) clang/docs/CMakeLists.txt (+1) - (modified) clang/lib/Analysis/FlowSensitive/CMakeLists.txt (+1) - (modified) clang/lib/Headers/CMakeLists.txt (+2-2) - (modified) clang/lib/Tooling/CMakeLists.txt (+2) - (modified) clang/test/CMakeLists.txt (+2-3) - (modified) clang/tools/libclang/CMakeLists.txt (+1-1) - (modified) clang/unittests/CMakeLists.txt (+1-1) - (modified) clang/utils/ClangVisualizers/CMakeLists.txt (+1-1) - (modified) clang/utils/TableGen/CMakeLists.txt (-2) - (modified) clang/utils/hmaptool/CMakeLists.txt (+1-1) ``diff diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index f092766fa19f07..09da3ad9979ffd 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 3.20.0) +set(LLVM_SUBPROJECT_TITLE "Clang") if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS) set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) @@ -390,7 +391,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) # Installing the headers needs to depend on generating any public # tablegen'd headers. add_custom_target(clang-headers DEPENDS clang-tablegen-targets) - set_target_properties(clang-headers PROPERTIES FOLDER "Misc") + set_target_properties(clang-headers PROPERTIES FOLDER "Clang/Resources") if(NOT LLVM_ENABLE_IDE) add_llvm_install_targets(install-clang-headers DEPENDS clang-headers @@ -398,6 +399,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) endif() add_custom_target(bash-autocomplete DEPENDS utils/bash-autocomplete.sh) + set_target_properties(bash-autocomplete PROPERTIES FOLDER "Clang/Misc") install(FILES utils/bash-autocomplete.sh DESTINATION "${CMAKE_INSTALL_DATADIR}/clang" COMPONENT bash-autocomplete) @@ -478,7 +480,7 @@ add_custom_target(clang-tablegen-targets omp_gen ClangDriverOptions ${CLANG_TABLEGEN_TARGETS}) -set_target_properties(clang-tablegen-targets PROPERTIES FOLDER "Misc") +set_target_properties(clang-tablegen-targets PROPERTIES FOLDER "Clang/Tablegenning/Targets") list(APPEND LLVM_COMMON_DEPENDS clang-tablegen-targets) # Force target to be built as soon as possible. Clang modules builds depend @@ -541,7 +543,7 @@ endif() # Custom target to install all clang libraries. add_custom_target(clang-libraries) -set_target_properties(clang-libraries PROPERTIES FOLDER "Misc") +set_target_properties(clang-libraries PROPERTIES FOLDER "Clang/Install") if(NOT LLVM_ENABLE_IDE) add_llvm_install_targets(install-clang-libraries diff --git a/clang/bindings/python/tests/CMakeLists.txt b/clang/bindings/python/tests/CMakeLists.txt index c4cd2539e9d6cf..2543cf739463d9 100644 --- a/clang/bindings/python/tests/CMakeLists.txt +++ b/clang/bindings/python/tests/CMakeLists.txt @@ -11,7 +11,7 @@ add_custom_target(check-clang-python WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..) set(RUN_PYTHON_TESTS TRUE) -set_target_properties(check-clang-python PROPERTIES FOLDER "Clang tests") +set_target_properties(check-clang-python PROPERTIES FOLDER "Clang/Tests") # Tests require libclang.so which is only built with LLVM_ENABLE_PIC=ON if(NOT LLVM_ENABLE_PIC) diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake index 75b0080f671564..a5ef639187d9db 100644 --- a/clang/cmake/modules/AddClang.cmake +++ b/clang/cmake/modules/AddClang.cmake @@ -26,7 +26,6 @@ function(clang_tablegen) if(CTG_TARGET) add_public_tablegen_target(${CTG_TARGET}) -set_target_properties( ${CTG_TARGET} PROPERTIES FOLDER "Clang tablegenning") set_property(GLOBAL APPEND PROPERTY CLANG_TABLEGEN_TARGETS ${CTG_TARGET}) endif() en
[llvm-branch-commits] [clang] [clang] Revise IDE folder structure (PR #89743)
https://github.com/Meinersbur updated https://github.com/llvm/llvm-project/pull/89743 >From afadef1f53e03e2cf3a1695f3c693913b27382dd Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Tue, 23 Apr 2024 13:03:11 +0200 Subject: [PATCH 1/2] [clang] Revise IDE folder structure --- clang/CMakeLists.txt| 8 +--- clang/bindings/python/tests/CMakeLists.txt | 2 +- clang/cmake/modules/AddClang.cmake | 3 --- clang/docs/CMakeLists.txt | 1 + clang/lib/Analysis/FlowSensitive/CMakeLists.txt | 1 + clang/lib/Headers/CMakeLists.txt| 4 ++-- clang/lib/Tooling/CMakeLists.txt| 2 ++ clang/test/CMakeLists.txt | 5 ++--- clang/tools/libclang/CMakeLists.txt | 2 +- clang/unittests/CMakeLists.txt | 2 +- clang/utils/ClangVisualizers/CMakeLists.txt | 2 +- clang/utils/TableGen/CMakeLists.txt | 2 -- clang/utils/hmaptool/CMakeLists.txt | 2 +- 13 files changed, 18 insertions(+), 18 deletions(-) diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index f092766fa19f07..09da3ad9979ffd 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 3.20.0) +set(LLVM_SUBPROJECT_TITLE "Clang") if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS) set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) @@ -390,7 +391,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) # Installing the headers needs to depend on generating any public # tablegen'd headers. add_custom_target(clang-headers DEPENDS clang-tablegen-targets) - set_target_properties(clang-headers PROPERTIES FOLDER "Misc") + set_target_properties(clang-headers PROPERTIES FOLDER "Clang/Resources") if(NOT LLVM_ENABLE_IDE) add_llvm_install_targets(install-clang-headers DEPENDS clang-headers @@ -398,6 +399,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) endif() add_custom_target(bash-autocomplete DEPENDS utils/bash-autocomplete.sh) + set_target_properties(bash-autocomplete PROPERTIES FOLDER "Clang/Misc") install(FILES utils/bash-autocomplete.sh DESTINATION "${CMAKE_INSTALL_DATADIR}/clang" COMPONENT bash-autocomplete) @@ -478,7 +480,7 @@ add_custom_target(clang-tablegen-targets omp_gen ClangDriverOptions ${CLANG_TABLEGEN_TARGETS}) -set_target_properties(clang-tablegen-targets PROPERTIES FOLDER "Misc") +set_target_properties(clang-tablegen-targets PROPERTIES FOLDER "Clang/Tablegenning/Targets") list(APPEND LLVM_COMMON_DEPENDS clang-tablegen-targets) # Force target to be built as soon as possible. Clang modules builds depend @@ -541,7 +543,7 @@ endif() # Custom target to install all clang libraries. add_custom_target(clang-libraries) -set_target_properties(clang-libraries PROPERTIES FOLDER "Misc") +set_target_properties(clang-libraries PROPERTIES FOLDER "Clang/Install") if(NOT LLVM_ENABLE_IDE) add_llvm_install_targets(install-clang-libraries diff --git a/clang/bindings/python/tests/CMakeLists.txt b/clang/bindings/python/tests/CMakeLists.txt index c4cd2539e9d6cf..2543cf739463d9 100644 --- a/clang/bindings/python/tests/CMakeLists.txt +++ b/clang/bindings/python/tests/CMakeLists.txt @@ -11,7 +11,7 @@ add_custom_target(check-clang-python WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..) set(RUN_PYTHON_TESTS TRUE) -set_target_properties(check-clang-python PROPERTIES FOLDER "Clang tests") +set_target_properties(check-clang-python PROPERTIES FOLDER "Clang/Tests") # Tests require libclang.so which is only built with LLVM_ENABLE_PIC=ON if(NOT LLVM_ENABLE_PIC) diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake index 75b0080f671564..a5ef639187d9db 100644 --- a/clang/cmake/modules/AddClang.cmake +++ b/clang/cmake/modules/AddClang.cmake @@ -26,7 +26,6 @@ function(clang_tablegen) if(CTG_TARGET) add_public_tablegen_target(${CTG_TARGET}) -set_target_properties( ${CTG_TARGET} PROPERTIES FOLDER "Clang tablegenning") set_property(GLOBAL APPEND PROPERTY CLANG_TABLEGEN_TARGETS ${CTG_TARGET}) endif() endfunction(clang_tablegen) @@ -138,13 +137,11 @@ macro(add_clang_library name) endif() endforeach() - set_target_properties(${name} PROPERTIES FOLDER "Clang libraries") set_clang_windows_version_resource_properties(${name}) endmacro(add_clang_library) macro(add_clang_executable name) add_llvm_executable( ${name} ${ARGN} ) - set_target_properties(${name} PROPERTIES FOLDER "Clang executables") set_clang_windows_version_resource_properties(${name}) endmacro(add_clang_executable) diff --git a/clang/docs/CMakeLists.txt b/clang/docs/CMakeLists.txt index 4163dd2d90ad5b..51e9db29f887f3 100644 --- a/clang/docs/CMakeLists.txt +++ b/clang/docs/CMakeLists.txt @@ -78,6 +78,7 @@ if (LLVM_ENABLE_DOXYGEN) COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg WORKING_DIRECTORY
[llvm-branch-commits] [mlir] [MLIR][OpenMP] Update op verifiers dependent on omp.wsloop (2/5) (PR #89211)
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/89211 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [mlir] [MLIR][OpenMP] Update omp.wsloop translation to LLVM IR (4/5) (PR #89214)
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/89214 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [OpenMP][MLIR] Add new arguments to map_info to help support record type maps (PR #82851)
@@ -1466,6 +1472,8 @@ def MapInfoOp : OpenMP_Op<"map.info", [AttrSizedOperandSegments]> { - 'map_capture_type': Capture type for the variable e.g. this, byref, byvalue, byvla this can affect how the variable is lowered. - `name`: Holds the name of variable as specified in user clause (including bounds). +- `partial_map`: The record type being mapped will not be mapped in its entirety, agozillon wrote: Looks like I need an extension to indicate spaces or remove unnecessary ones at the end of lines! Sorry about that. https://github.com/llvm/llvm-project/pull/82851 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [OpenMP][MLIR] Add new arguments to map_info to help support record type maps (PR #82851)
https://github.com/agozillon edited https://github.com/llvm/llvm-project/pull/82851 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)
@@ -2283,16 +2386,12 @@ static void processMapMembersWithParent( for (auto mappedMembers : parentClause.getMembers()) { auto memberClause = mlir::dyn_cast(mappedMembers.getDefiningOp()); agozillon wrote: should be fine to fix it in this PR as we're altering the file in any case! But, I can perhaps do a follow up PR to adjust these cases, I have a bad habit of using dyn_cast as opposed to cast, usually I check the result, but it seems I've done that infrequently in this PR at the least! https://github.com/llvm/llvm-project/pull/82852 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)
@@ -811,9 +811,10 @@ mlir::omp::MapInfoOp createMapInfoOp(fir::FirOpBuilder &builder, mlir::Location loc, agozillon wrote: I can move it :-) the implementation just seems to have missed the migration as the declaration exists in the Utils header. https://github.com/llvm/llvm-project/pull/82853 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] release/18.x: [libcxx] [modules] Add _LIBCPP_USING_IF_EXISTS on aligned_alloc (#89827) (PR #89894)
https://github.com/mordante approved this pull request. https://github.com/llvm/llvm-project/pull/89894 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)
@@ -903,24 +908,39 @@ bool ClauseProcessor::processMap( // Explicit map captures are captured ByRef by default, // optimisation passes may alter this to ByCopy or other capture // types to optimise - mlir::Value mapOp = createMapInfoOp( + mlir::omp::MapInfoOp mapOp = createMapInfoOp( firOpBuilder, clauseLocation, symAddr, mlir::Value{}, - asFortran.str(), bounds, {}, + asFortran.str(), bounds, {}, mlir::DenseIntElementsAttr{}, static_cast< std::underlying_type_t>( mapTypeBits), mlir::omp::VariableCaptureKind::ByRef, symAddr.getType()); - result.mapVars.push_back(mapOp); - - if (mapSyms) + if (object.id()->owner().IsDerivedType()) { +if (auto dataRef{ExtractDataRef(object.designator)}) { agozillon wrote: It's expected behavior as there's nothing we can really do without the information, we'd be missing the parent symbol required to perform the next steps unfortunately. So I'll emit an assert in this case, as there likely is no fallback (at least that I can think of). https://github.com/llvm/llvm-project/pull/82853 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)
@@ -185,7 +184,12 @@ template bool ClauseProcessor::processMotionClauses( agozillon wrote: I agree and have been thinking about it, as there isn't a whole lot of dissimilarities, most changes to processMapClauses need replicated to processMotionClauses and it would make testing a lot simpler! But it'd also be up to @ergawy I am unsure if he'd like to keep them distinct and has some insights into motion clauses that might make merging the two functions unideal! But I can make a follow up PR after the stack has landed to merge them if we are all happy doing so. https://github.com/llvm/llvm-project/pull/82853 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)
@@ -115,8 +115,7 @@ class ClauseProcessor { bool processMap( mlir::Location currentLocation, Fortran::lower::StatementContext &stmtCtx, mlir::omp::MapClauseOps &result, - llvm::SmallVectorImpl *mapSyms = - nullptr, + llvm::SmallVectorImpl *mapSyms, agozillon wrote: I had this originally, it felt a little messy to me from what I recall so I opted for this! But if you prefer the other option and it makes more sense to you, I am perfectly happy with it as well :-) https://github.com/llvm/llvm-project/pull/82853 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang][CallGraphSection] Add type id metadata to indirect call and targets (PR #87573)
https://github.com/Prabhuk updated https://github.com/llvm/llvm-project/pull/87573 >From a8a5848885e12c771f12cfa33b4dbc6a0272e925 Mon Sep 17 00:00:00 2001 From: Prabhuk Date: Mon, 22 Apr 2024 11:34:04 -0700 Subject: [PATCH 1/2] Update clang/lib/CodeGen/CodeGenModule.cpp Cleaner if checks. Co-authored-by: Matt Arsenault --- clang/lib/CodeGen/CodeGenModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index e19bbee996f582..ff1586d2fa8abe 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -2711,7 +2711,7 @@ void CodeGenModule::CreateFunctionTypeMetadataForIcall(const FunctionDecl *FD, void CodeGenModule::CreateFunctionTypeMetadataForIcall(const QualType &QT, llvm::CallBase *CB) { // Only if needed for call graph section and only for indirect calls. - if (!(CodeGenOpts.CallGraphSection && CB && CB->isIndirectCall())) + if (!CodeGenOpts.CallGraphSection || !CB || !CB->isIndirectCall()) return; auto *MD = CreateMetadataIdentifierGeneralized(QT); >From 019b2ca5e1c263183ed114e0b967b4e77b4a17a8 Mon Sep 17 00:00:00 2001 From: Prabhuk Date: Mon, 22 Apr 2024 11:34:31 -0700 Subject: [PATCH 2/2] Update clang/lib/CodeGen/CodeGenModule.cpp Update the comments as suggested. Co-authored-by: Matt Arsenault --- clang/lib/CodeGen/CodeGenModule.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index ff1586d2fa8abe..5635a87d2358a7 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -2680,9 +2680,9 @@ void CodeGenModule::CreateFunctionTypeMetadataForIcall(const FunctionDecl *FD, bool EmittedMDIdGeneralized = false; if (CodeGenOpts.CallGraphSection && (!F->hasLocalLinkage() || - F->getFunction().hasAddressTaken(nullptr, /* IgnoreCallbackUses */ true, -/* IgnoreAssumeLikeCalls */ true, -/* IgnoreLLVMUsed */ false))) { + F->getFunction().hasAddressTaken(nullptr, /*IgnoreCallbackUses=*/ true, +/*IgnoreAssumeLikeCalls=*/ true, +/*IgnoreLLVMUsed=*/ false))) { F->addTypeMetadata(0, CreateMetadataIdentifierGeneralized(FD->getType())); EmittedMDIdGeneralized = true; } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang][CallGraphSection] Add type id metadata to indirect call and targets (PR #87573)
https://github.com/Prabhuk updated https://github.com/llvm/llvm-project/pull/87573 >From a8a5848885e12c771f12cfa33b4dbc6a0272e925 Mon Sep 17 00:00:00 2001 From: Prabhuk Date: Mon, 22 Apr 2024 11:34:04 -0700 Subject: [PATCH 1/2] Update clang/lib/CodeGen/CodeGenModule.cpp Cleaner if checks. Co-authored-by: Matt Arsenault --- clang/lib/CodeGen/CodeGenModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index e19bbee996f582..ff1586d2fa8abe 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -2711,7 +2711,7 @@ void CodeGenModule::CreateFunctionTypeMetadataForIcall(const FunctionDecl *FD, void CodeGenModule::CreateFunctionTypeMetadataForIcall(const QualType &QT, llvm::CallBase *CB) { // Only if needed for call graph section and only for indirect calls. - if (!(CodeGenOpts.CallGraphSection && CB && CB->isIndirectCall())) + if (!CodeGenOpts.CallGraphSection || !CB || !CB->isIndirectCall()) return; auto *MD = CreateMetadataIdentifierGeneralized(QT); >From 019b2ca5e1c263183ed114e0b967b4e77b4a17a8 Mon Sep 17 00:00:00 2001 From: Prabhuk Date: Mon, 22 Apr 2024 11:34:31 -0700 Subject: [PATCH 2/2] Update clang/lib/CodeGen/CodeGenModule.cpp Update the comments as suggested. Co-authored-by: Matt Arsenault --- clang/lib/CodeGen/CodeGenModule.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index ff1586d2fa8abe..5635a87d2358a7 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -2680,9 +2680,9 @@ void CodeGenModule::CreateFunctionTypeMetadataForIcall(const FunctionDecl *FD, bool EmittedMDIdGeneralized = false; if (CodeGenOpts.CallGraphSection && (!F->hasLocalLinkage() || - F->getFunction().hasAddressTaken(nullptr, /* IgnoreCallbackUses */ true, -/* IgnoreAssumeLikeCalls */ true, -/* IgnoreLLVMUsed */ false))) { + F->getFunction().hasAddressTaken(nullptr, /*IgnoreCallbackUses=*/ true, +/*IgnoreAssumeLikeCalls=*/ true, +/*IgnoreLLVMUsed=*/ false))) { F->addTypeMetadata(0, CreateMetadataIdentifierGeneralized(FD->getType())); EmittedMDIdGeneralized = true; } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [COFF][Aarch64] Add _InterlockedAdd64 intrinsic (#81849) (PR #89951)
https://github.com/dpaoliello milestoned https://github.com/llvm/llvm-project/pull/89951 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [COFF][Aarch64] Add _InterlockedAdd64 intrinsic (#81849) (PR #89951)
https://github.com/dpaoliello created https://github.com/llvm/llvm-project/pull/89951 Found when compiling openssl master branch using clang-cl. This commit introduces usage of InterlockedAdd64: https://github.com/openssl/openssl/commit/d0e1a0ae701cfaca7f3dd3bf28a3f934a6408813 https://learn.microsoft.com/en-us/cpp/intrinsics/interlockedadd-intrinsic-functions >From cb4faf6d335095111b1265efd2c3cd87882cce41 Mon Sep 17 00:00:00 2001 From: Pierrick Bouvier Date: Fri, 16 Feb 2024 15:20:08 +0400 Subject: [PATCH] [COFF][Aarch64] Add _InterlockedAdd64 intrinsic (#81849) Found when compiling openssl master branch using clang-cl. This commit introduces usage of InterlockedAdd64: https://github.com/openssl/openssl/commit/d0e1a0ae701cfaca7f3dd3bf28a3f934a6408813 https://learn.microsoft.com/en-us/cpp/intrinsics/interlockedadd-intrinsic-functions --- clang/include/clang/Basic/BuiltinsAArch64.def | 1 + clang/lib/CodeGen/CGBuiltin.cpp | 3 ++- clang/lib/Headers/intrin.h | 1 + clang/test/CodeGen/arm64-microsoft-intrinsics.c | 14 ++ clang/test/CodeGen/ms-intrinsics-other.c| 9 + clang/test/CodeGen/ms-intrinsics-underaligned.c | 6 ++ 6 files changed, 33 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/Basic/BuiltinsAArch64.def b/clang/include/clang/Basic/BuiltinsAArch64.def index 31ec84143f65c1..b5cbe90c8fd6a3 100644 --- a/clang/include/clang/Basic/BuiltinsAArch64.def +++ b/clang/include/clang/Basic/BuiltinsAArch64.def @@ -139,6 +139,7 @@ TARGET_HEADER_BUILTIN(_BitScanForward64, "UcUNi*ULLi", "nh", INTRIN_H, ALL_MS_LA TARGET_HEADER_BUILTIN(_BitScanReverse64, "UcUNi*ULLi", "nh", INTRIN_H, ALL_MS_LANGUAGES, "") TARGET_HEADER_BUILTIN(_InterlockedAdd, "NiNiD*Ni","nh", INTRIN_H, ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedAdd64, "LLiLLiD*LLi", "nh", INTRIN_H, ALL_MS_LANGUAGES, "") TARGET_HEADER_BUILTIN(_InterlockedAnd64, "LLiLLiD*LLi", "nh", INTRIN_H, ALL_MS_LANGUAGES, "") TARGET_HEADER_BUILTIN(_InterlockedDecrement64, "LLiLLiD*","nh", INTRIN_H, ALL_MS_LANGUAGES, "") TARGET_HEADER_BUILTIN(_InterlockedExchange64,"LLiLLiD*LLi", "nh", INTRIN_H, ALL_MS_LANGUAGES, "") diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index a4f26a6f0eb19b..05a898a24b5890 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -12044,7 +12044,8 @@ Value *CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID, "vgetq_lane"); } - case clang::AArch64::BI_InterlockedAdd: { + case clang::AArch64::BI_InterlockedAdd: + case clang::AArch64::BI_InterlockedAdd64: { Address DestAddr = CheckAtomicAlignment(*this, E); Value *Val = EmitScalarExpr(E->getArg(1)); AtomicRMWInst *RMWI = diff --git a/clang/lib/Headers/intrin.h b/clang/lib/Headers/intrin.h index 9ebaea9fee9421..a6395143db54c2 100644 --- a/clang/lib/Headers/intrin.h +++ b/clang/lib/Headers/intrin.h @@ -551,6 +551,7 @@ static __inline__ void __DEFAULT_FN_ATTRS __nop(void) { #if defined(__aarch64__) unsigned __int64 __getReg(int); long _InterlockedAdd(long volatile *Addend, long Value); +__int64 _InterlockedAdd64(__int64 volatile *Addend, __int64 Value); __int64 _ReadStatusReg(int); void _WriteStatusReg(int, __int64); diff --git a/clang/test/CodeGen/arm64-microsoft-intrinsics.c b/clang/test/CodeGen/arm64-microsoft-intrinsics.c index 44b2ee28fe5681..a354ed948ca5f1 100644 --- a/clang/test/CodeGen/arm64-microsoft-intrinsics.c +++ b/clang/test/CodeGen/arm64-microsoft-intrinsics.c @@ -21,6 +21,20 @@ long test_InterlockedAdd_constant(long volatile *Addend) { // CHECK-MSVC: ret i32 %[[NEWVAL:[0-9]+]] // CHECK-LINUX: error: call to undeclared function '_InterlockedAdd' +__int64 test_InterlockedAdd64(__int64 volatile *Addend, __int64 Value) { + return _InterlockedAdd64(Addend, Value); +} + +__int64 test_InterlockedAdd64_constant(__int64 volatile *Addend) { + return _InterlockedAdd64(Addend, -1); +} + +// CHECK-LABEL: define {{.*}} i64 @test_InterlockedAdd64(ptr %Addend, i64 %Value) {{.*}} { +// CHECK-MSVC: %[[OLDVAL:[0-9]+]] = atomicrmw add ptr %1, i64 %2 seq_cst, align 8 +// CHECK-MSVC: %[[NEWVAL:[0-9]+]] = add i64 %[[OLDVAL:[0-9]+]], %2 +// CHECK-MSVC: ret i64 %[[NEWVAL:[0-9]+]] +// CHECK-LINUX: error: call to undeclared function '_InterlockedAdd64' + void check__dmb(void) { __dmb(0); } diff --git a/clang/test/CodeGen/ms-intrinsics-other.c b/clang/test/CodeGen/ms-intrinsics-other.c index 76f54add749669..36c40dddcbb4f5 100644 --- a/clang/test/CodeGen/ms-intrinsics-other.c +++ b/clang/test/CodeGen/ms-intrinsics-other.c @@ -240,6 +240,15 @@ LONG test_InterlockedAdd(LONG volatile *Addend, LONG Value) { // CHECK-ARM-ARM64: %[[OLDVAL:[0-9]+]] = atomicrmw add ptr %Addend, i32 %Value seq_cst, align 4 // CHECK-ARM-ARM64: %[[NEWVAL:[0-9]+]] = add i32 %[[OLDVAL:[0-9]+]], %Value // CHECK-ARM-ARM64: ret
[llvm-branch-commits] [clang] [COFF][Aarch64] Add _InterlockedAdd64 intrinsic (#81849) (PR #89951)
llvmbot wrote: @llvm/pr-subscribers-clang-codegen @llvm/pr-subscribers-backend-x86 Author: Daniel Paoliello (dpaoliello) Changes Found when compiling openssl master branch using clang-cl. This commit introduces usage of InterlockedAdd64: https://github.com/openssl/openssl/commit/d0e1a0ae701cfaca7f3dd3bf28a3f934a6408813 https://learn.microsoft.com/en-us/cpp/intrinsics/interlockedadd-intrinsic-functions --- Full diff: https://github.com/llvm/llvm-project/pull/89951.diff 6 Files Affected: - (modified) clang/include/clang/Basic/BuiltinsAArch64.def (+1) - (modified) clang/lib/CodeGen/CGBuiltin.cpp (+2-1) - (modified) clang/lib/Headers/intrin.h (+1) - (modified) clang/test/CodeGen/arm64-microsoft-intrinsics.c (+14) - (modified) clang/test/CodeGen/ms-intrinsics-other.c (+9) - (modified) clang/test/CodeGen/ms-intrinsics-underaligned.c (+6) ``diff diff --git a/clang/include/clang/Basic/BuiltinsAArch64.def b/clang/include/clang/Basic/BuiltinsAArch64.def index 31ec84143f65c1..b5cbe90c8fd6a3 100644 --- a/clang/include/clang/Basic/BuiltinsAArch64.def +++ b/clang/include/clang/Basic/BuiltinsAArch64.def @@ -139,6 +139,7 @@ TARGET_HEADER_BUILTIN(_BitScanForward64, "UcUNi*ULLi", "nh", INTRIN_H, ALL_MS_LA TARGET_HEADER_BUILTIN(_BitScanReverse64, "UcUNi*ULLi", "nh", INTRIN_H, ALL_MS_LANGUAGES, "") TARGET_HEADER_BUILTIN(_InterlockedAdd, "NiNiD*Ni","nh", INTRIN_H, ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_InterlockedAdd64, "LLiLLiD*LLi", "nh", INTRIN_H, ALL_MS_LANGUAGES, "") TARGET_HEADER_BUILTIN(_InterlockedAnd64, "LLiLLiD*LLi", "nh", INTRIN_H, ALL_MS_LANGUAGES, "") TARGET_HEADER_BUILTIN(_InterlockedDecrement64, "LLiLLiD*","nh", INTRIN_H, ALL_MS_LANGUAGES, "") TARGET_HEADER_BUILTIN(_InterlockedExchange64,"LLiLLiD*LLi", "nh", INTRIN_H, ALL_MS_LANGUAGES, "") diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index a4f26a6f0eb19b..05a898a24b5890 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -12044,7 +12044,8 @@ Value *CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID, "vgetq_lane"); } - case clang::AArch64::BI_InterlockedAdd: { + case clang::AArch64::BI_InterlockedAdd: + case clang::AArch64::BI_InterlockedAdd64: { Address DestAddr = CheckAtomicAlignment(*this, E); Value *Val = EmitScalarExpr(E->getArg(1)); AtomicRMWInst *RMWI = diff --git a/clang/lib/Headers/intrin.h b/clang/lib/Headers/intrin.h index 9ebaea9fee9421..a6395143db54c2 100644 --- a/clang/lib/Headers/intrin.h +++ b/clang/lib/Headers/intrin.h @@ -551,6 +551,7 @@ static __inline__ void __DEFAULT_FN_ATTRS __nop(void) { #if defined(__aarch64__) unsigned __int64 __getReg(int); long _InterlockedAdd(long volatile *Addend, long Value); +__int64 _InterlockedAdd64(__int64 volatile *Addend, __int64 Value); __int64 _ReadStatusReg(int); void _WriteStatusReg(int, __int64); diff --git a/clang/test/CodeGen/arm64-microsoft-intrinsics.c b/clang/test/CodeGen/arm64-microsoft-intrinsics.c index 44b2ee28fe5681..a354ed948ca5f1 100644 --- a/clang/test/CodeGen/arm64-microsoft-intrinsics.c +++ b/clang/test/CodeGen/arm64-microsoft-intrinsics.c @@ -21,6 +21,20 @@ long test_InterlockedAdd_constant(long volatile *Addend) { // CHECK-MSVC: ret i32 %[[NEWVAL:[0-9]+]] // CHECK-LINUX: error: call to undeclared function '_InterlockedAdd' +__int64 test_InterlockedAdd64(__int64 volatile *Addend, __int64 Value) { + return _InterlockedAdd64(Addend, Value); +} + +__int64 test_InterlockedAdd64_constant(__int64 volatile *Addend) { + return _InterlockedAdd64(Addend, -1); +} + +// CHECK-LABEL: define {{.*}} i64 @test_InterlockedAdd64(ptr %Addend, i64 %Value) {{.*}} { +// CHECK-MSVC: %[[OLDVAL:[0-9]+]] = atomicrmw add ptr %1, i64 %2 seq_cst, align 8 +// CHECK-MSVC: %[[NEWVAL:[0-9]+]] = add i64 %[[OLDVAL:[0-9]+]], %2 +// CHECK-MSVC: ret i64 %[[NEWVAL:[0-9]+]] +// CHECK-LINUX: error: call to undeclared function '_InterlockedAdd64' + void check__dmb(void) { __dmb(0); } diff --git a/clang/test/CodeGen/ms-intrinsics-other.c b/clang/test/CodeGen/ms-intrinsics-other.c index 76f54add749669..36c40dddcbb4f5 100644 --- a/clang/test/CodeGen/ms-intrinsics-other.c +++ b/clang/test/CodeGen/ms-intrinsics-other.c @@ -240,6 +240,15 @@ LONG test_InterlockedAdd(LONG volatile *Addend, LONG Value) { // CHECK-ARM-ARM64: %[[OLDVAL:[0-9]+]] = atomicrmw add ptr %Addend, i32 %Value seq_cst, align 4 // CHECK-ARM-ARM64: %[[NEWVAL:[0-9]+]] = add i32 %[[OLDVAL:[0-9]+]], %Value // CHECK-ARM-ARM64: ret i32 %[[NEWVAL:[0-9]+]] + +__int64 test_InterlockedAdd64(__int64 volatile *Addend, __int64 Value) { + return _InterlockedAdd64(Addend, Value); +} + +// CHECK-ARM-ARM64: define{{.*}}i64 @test_InterlockedAdd64(ptr{{[a-z_ ]*}}%Addend, i64 noundef %Value) {{.*}} { +// CHECK-ARM-ARM64: %[[OLDVAL:[0-9]+]] = atomicrmw add ptr %Addend, i64 %Value seq_cst, align 8 +// CHECK-ARM-ARM64: %[[NEWVAL:[0
[llvm-branch-commits] [clang] [release/18.x][COFF][Aarch64] Add _InterlockedAdd64 intrinsic (#81849) (PR #89951)
https://github.com/dpaoliello edited https://github.com/llvm/llvm-project/pull/89951 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [release/18.x][COFF][Aarch64] Add _InterlockedAdd64 intrinsic (#81849) (PR #89951)
https://github.com/dpaoliello edited https://github.com/llvm/llvm-project/pull/89951 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)
@@ -88,6 +91,175 @@ void gatherFuncAndVarSyms( symbolAndClause.emplace_back(clause, *object.id()); } +int getComponentPlacementInParent( +const Fortran::semantics::Symbol *componentSym) { + const auto *derived = + componentSym->owner() + .derivedTypeSpec() + ->typeSymbol() + .detailsIf(); + assert(derived && + "expected derived type details when processing component symbol"); + int placement = 0; + for (auto t : derived->componentNames()) { +if (t == componentSym->name()) + return placement; +placement++; + } + return -1; +} + +std::optional +getCompObjOrNull(std::optional object, + Fortran::semantics::SemanticsContext &semaCtx) { + if (!object) +return std::nullopt; + + auto ref = evaluate::ExtractDataRef(*object.value().ref()); + if (!ref) +return std::nullopt; + + if (std::get_if(&ref->u)) +return object; + + auto baseObj = getBaseObject(object.value(), semaCtx); + if (!baseObj) +return std::nullopt; + + return getCompObjOrNull(baseObj.value(), semaCtx); +} + +llvm::SmallVector +generateMemberPlacementIndices(const Object &object, + Fortran::semantics::SemanticsContext &semaCtx) { + std::list indices; + auto compObj = getCompObjOrNull(object, semaCtx); + while (compObj) { +indices.push_front(getComponentPlacementInParent(compObj->id())); +compObj = +getCompObjOrNull(getBaseObject(compObj.value(), semaCtx), semaCtx); + } + + return llvm::SmallVector{std::begin(indices), std::end(indices)}; agozillon wrote: makes a lot of sense, thanks :-) https://github.com/llvm/llvm-project/pull/82853 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [compiler-rt] [compiler-rt] Revise IDE folder structure (PR #89753)
@@ -89,15 +89,15 @@ function(add_compiler_rt_object_libraries name) "${libname}" MATCHES ".*\.osx.*") foreach(arch ${LIB_ARCHS_${libname}}) list(APPEND target_flags - "SHELL:-target ${arch}-apple-macos${DARWIN_osx_MIN_VER} -darwin-target-variant ${arch}-apple-ios13.1-macabi") + "SHELL:-target ${arch}-apple-macos${DARWIN_osx_MIN_V357ER} -darwin-target-variant ${arch}-apple-ios13.1-macabi") dtellenbach wrote: What's the reason for this? https://github.com/llvm/llvm-project/pull/89753 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [CallGraphSection] Add call graph section options and documentation (PR #87572)
https://github.com/Prabhuk updated https://github.com/llvm/llvm-project/pull/87572 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [CallGraphSection] Add call graph section options and documentation (PR #87572)
https://github.com/Prabhuk updated https://github.com/llvm/llvm-project/pull/87572 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang][CallGraphSection] Add type id metadata to indirect call and targets (PR #87573)
@@ -93,9 +93,17 @@ RValue CodeGenFunction::EmitCXXMemberOrOperatorCall( *this, MD, This, ImplicitParam, ImplicitParamTy, CE, Args, RtlArgs); auto &FnInfo = CGM.getTypes().arrangeCXXMethodCall( Args, FPT, CallInfo.ReqArgs, CallInfo.PrefixSize); - return EmitCall(FnInfo, Callee, ReturnValue, Args, nullptr, + llvm::CallBase *CallOrInvoke = nullptr; + auto Call = EmitCall(FnInfo, Callee, ReturnValue, Args, &CallOrInvoke, CE && CE == MustTailCall, CE ? CE->getExprLoc() : SourceLocation()); + + // Set type identifier metadata of indirect calls for call graph section. + if (CGM.getCodeGenOpts().CallGraphSection && CallOrInvoke && + CallOrInvoke->isIndirectCall()) +CGM.CreateFunctionTypeMetadataForIcall(MD->getType(), CallOrInvoke); Prabhuk wrote: Refactored as suggested. https://github.com/llvm/llvm-project/pull/87573 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [CIR][NFC] Add scaffolding for the CIR dialect and CIROps.td (PR #86080)
@@ -0,0 +1,6 @@ +set(MLIR_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/../mlir/include ) # --includedir +set(MLIR_TABLEGEN_OUTPUT_DIR ${CMAKE_BINARY_DIR}/tools/mlir/include) lanza wrote: @Ericson2314 any protest against marking that as just "not yet supported?" e.g. ``` if (CLANG_ENABLE_CIR && CLANG_STANDALONE_BUILD) message(ERROR "ClangIR is not yet supported in the standalone build") endif() ``` https://github.com/llvm/llvm-project/pull/86080 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [CIR][NFC] Add scaffolding for the CIR dialect and CIROps.td (PR #86080)
https://github.com/lanza updated https://github.com/llvm/llvm-project/pull/86080 >From 435869501bb0788d8b22d847c3a870dbfbf94126 Mon Sep 17 00:00:00 2001 From: Nathan Lanza Date: Thu, 21 Mar 2024 04:57:16 + Subject: [PATCH 1/4] fix MLIRCIROpsIncGen Created using spr 1.3.5 --- .../clang/CIR/Dialect/IR/CIRDialect.td| 46 +++ clang/include/clang/CIR/Dialect/IR/CIROps.td | 18 2 files changed, 64 insertions(+) create mode 100644 clang/include/clang/CIR/Dialect/IR/CIRDialect.td diff --git a/clang/include/clang/CIR/Dialect/IR/CIRDialect.td b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td new file mode 100644 index 00..8f756fa422e5f3 --- /dev/null +++ b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td @@ -0,0 +1,46 @@ +//===- CIRTypes.td - CIR dialect types -*- tablegen -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// This file declares the CIR dialect. +// +//===--===// + +#ifndef MLIR_CIR_DIALECT_CIR +#define MLIR_CIR_DIALECT_CIR + +include "mlir/IR/OpBase.td" + +def CIR_Dialect : Dialect { + let name = "cir"; + + // A short one-line summary of our dialect. + let summary = "A high-level dialect for analyzing and optimizing Clang " +"supported languages"; + + let cppNamespace = "::mlir::cir"; + + let useDefaultAttributePrinterParser = 0; + let useDefaultTypePrinterParser = 0; + + let extraClassDeclaration = [{ +void registerAttributes(); +void registerTypes(); + +::mlir::Type parseType(::mlir::DialectAsmParser &parser) const override; +void printType(::mlir::Type type, + ::mlir::DialectAsmPrinter &printer) const override; + +::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const override; + +void printAttribute(::mlir::Attribute attr, +::mlir::DialectAsmPrinter &os) const override; + }]; +} + +#endif // MLIR_CIR_DIALECT_CIR diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td index e69de29bb2d1d6..cfc62986b0b9d1 100644 --- a/clang/include/clang/CIR/Dialect/IR/CIROps.td +++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td @@ -0,0 +1,18 @@ +//===-- CIROps.td - CIR dialect definition -*- tablegen -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +/// +/// \file +/// Definition of the CIR dialect +/// +//===--===// + +#ifndef MLIR_CIR_DIALECT_CIR_OPS +#define MLIR_CIR_DIALECT_CIR_OPS + +include "clang/CIR/Dialect/IR/CIRDialect.td" +#endif // MLIR_CIR_DIALECT_CIR_OPS >From fe44284534be0752d95634251289a5c74c06afe7 Mon Sep 17 00:00:00 2001 From: Nathan Lanza Date: Thu, 21 Mar 2024 05:12:26 + Subject: [PATCH 2/4] add some guts to CIRDialect.cpp and MLIRCIR lib Created using spr 1.3.5 --- clang/lib/CIR/Dialect/IR/CIRDialect.cpp | 11 +++ clang/lib/CIR/Dialect/IR/CMakeLists.txt | 3 +++ 2 files changed, 14 insertions(+) diff --git a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp index e69de29bb2d1d6..8abf39119e04f7 100644 --- a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp +++ b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp @@ -0,0 +1,11 @@ +//===- CIRDialect.cpp - MLIR CIR ops implementation ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// This file implements the CIR dialect and its operations. +// +//===--===// diff --git a/clang/lib/CIR/Dialect/IR/CMakeLists.txt b/clang/lib/CIR/Dialect/IR/CMakeLists.txt index e69de29bb2d1d6..0d7476b555705d 100644 --- a/clang/lib/CIR/Dialect/IR/CMakeLists.txt +++ b/clang/lib/CIR/Dialect/IR/CMakeLists.txt @@ -0,0 +1,3 @@ +add_clang_library(MLIRCIR + CIRDialect.cpp + ) >From 0e195548f24fb3748e22141739f914676b1d56d5 Mon Sep 17 00:00:00 2001 From: Nathan Lanza Date: Wed, 17 Apr 2024 18:59:53 + Subject: [PATCH 3/4] include dialect and add include guards Created using spr 1.3.5 --- clang/include/clang/CIR/Dialect/IR/CIRDialect.h | 5 + clang/l
[llvm-branch-commits] [CallGraphSection] Add call graph section options and documentation (PR #87572)
https://github.com/Prabhuk updated https://github.com/llvm/llvm-project/pull/87572 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [CallGraphSection] Add call graph section options and documentation (PR #87572)
https://github.com/Prabhuk updated https://github.com/llvm/llvm-project/pull/87572 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang][CallGraphSection] Add type id metadata to indirect call and targets (PR #87573)
https://github.com/Prabhuk updated https://github.com/llvm/llvm-project/pull/87573 >From a8a5848885e12c771f12cfa33b4dbc6a0272e925 Mon Sep 17 00:00:00 2001 From: Prabhuk Date: Mon, 22 Apr 2024 11:34:04 -0700 Subject: [PATCH 1/2] Update clang/lib/CodeGen/CodeGenModule.cpp Cleaner if checks. Co-authored-by: Matt Arsenault --- clang/lib/CodeGen/CodeGenModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index e19bbee996f582..ff1586d2fa8abe 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -2711,7 +2711,7 @@ void CodeGenModule::CreateFunctionTypeMetadataForIcall(const FunctionDecl *FD, void CodeGenModule::CreateFunctionTypeMetadataForIcall(const QualType &QT, llvm::CallBase *CB) { // Only if needed for call graph section and only for indirect calls. - if (!(CodeGenOpts.CallGraphSection && CB && CB->isIndirectCall())) + if (!CodeGenOpts.CallGraphSection || !CB || !CB->isIndirectCall()) return; auto *MD = CreateMetadataIdentifierGeneralized(QT); >From 019b2ca5e1c263183ed114e0b967b4e77b4a17a8 Mon Sep 17 00:00:00 2001 From: Prabhuk Date: Mon, 22 Apr 2024 11:34:31 -0700 Subject: [PATCH 2/2] Update clang/lib/CodeGen/CodeGenModule.cpp Update the comments as suggested. Co-authored-by: Matt Arsenault --- clang/lib/CodeGen/CodeGenModule.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index ff1586d2fa8abe..5635a87d2358a7 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -2680,9 +2680,9 @@ void CodeGenModule::CreateFunctionTypeMetadataForIcall(const FunctionDecl *FD, bool EmittedMDIdGeneralized = false; if (CodeGenOpts.CallGraphSection && (!F->hasLocalLinkage() || - F->getFunction().hasAddressTaken(nullptr, /* IgnoreCallbackUses */ true, -/* IgnoreAssumeLikeCalls */ true, -/* IgnoreLLVMUsed */ false))) { + F->getFunction().hasAddressTaken(nullptr, /*IgnoreCallbackUses=*/ true, +/*IgnoreAssumeLikeCalls=*/ true, +/*IgnoreLLVMUsed=*/ false))) { F->addTypeMetadata(0, CreateMetadataIdentifierGeneralized(FD->getType())); EmittedMDIdGeneralized = true; } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang][CallGraphSection] Add type id metadata to indirect call and targets (PR #87573)
https://github.com/Prabhuk updated https://github.com/llvm/llvm-project/pull/87573 >From a8a5848885e12c771f12cfa33b4dbc6a0272e925 Mon Sep 17 00:00:00 2001 From: Prabhuk Date: Mon, 22 Apr 2024 11:34:04 -0700 Subject: [PATCH 1/2] Update clang/lib/CodeGen/CodeGenModule.cpp Cleaner if checks. Co-authored-by: Matt Arsenault --- clang/lib/CodeGen/CodeGenModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index e19bbee996f582..ff1586d2fa8abe 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -2711,7 +2711,7 @@ void CodeGenModule::CreateFunctionTypeMetadataForIcall(const FunctionDecl *FD, void CodeGenModule::CreateFunctionTypeMetadataForIcall(const QualType &QT, llvm::CallBase *CB) { // Only if needed for call graph section and only for indirect calls. - if (!(CodeGenOpts.CallGraphSection && CB && CB->isIndirectCall())) + if (!CodeGenOpts.CallGraphSection || !CB || !CB->isIndirectCall()) return; auto *MD = CreateMetadataIdentifierGeneralized(QT); >From 019b2ca5e1c263183ed114e0b967b4e77b4a17a8 Mon Sep 17 00:00:00 2001 From: Prabhuk Date: Mon, 22 Apr 2024 11:34:31 -0700 Subject: [PATCH 2/2] Update clang/lib/CodeGen/CodeGenModule.cpp Update the comments as suggested. Co-authored-by: Matt Arsenault --- clang/lib/CodeGen/CodeGenModule.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index ff1586d2fa8abe..5635a87d2358a7 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -2680,9 +2680,9 @@ void CodeGenModule::CreateFunctionTypeMetadataForIcall(const FunctionDecl *FD, bool EmittedMDIdGeneralized = false; if (CodeGenOpts.CallGraphSection && (!F->hasLocalLinkage() || - F->getFunction().hasAddressTaken(nullptr, /* IgnoreCallbackUses */ true, -/* IgnoreAssumeLikeCalls */ true, -/* IgnoreLLVMUsed */ false))) { + F->getFunction().hasAddressTaken(nullptr, /*IgnoreCallbackUses=*/ true, +/*IgnoreAssumeLikeCalls=*/ true, +/*IgnoreLLVMUsed=*/ false))) { F->addTypeMetadata(0, CreateMetadataIdentifierGeneralized(FD->getType())); EmittedMDIdGeneralized = true; } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [CallSiteInfo][CallGraphSection] Extend CallSiteInfo with TypeId (PR #87574)
https://github.com/Prabhuk updated https://github.com/llvm/llvm-project/pull/87574 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [CallSiteInfo][CallGraphSection] Extend CallSiteInfo with TypeId (PR #87574)
https://github.com/Prabhuk updated https://github.com/llvm/llvm-project/pull/87574 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [CallSiteInfo][CallGraphSection] Extract and propagate indirect call type ids (PR #87575)
https://github.com/Prabhuk updated https://github.com/llvm/llvm-project/pull/87575 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [CallSiteInfo][CallGraphSection] Extract and propagate indirect call type ids (PR #87575)
https://github.com/Prabhuk updated https://github.com/llvm/llvm-project/pull/87575 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [AsmPrinter][CallGraphSection] Emit call graph section (PR #87576)
https://github.com/Prabhuk updated https://github.com/llvm/llvm-project/pull/87576 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [AsmPrinter][CallGraphSection] Emit call graph section (PR #87576)
https://github.com/Prabhuk updated https://github.com/llvm/llvm-project/pull/87576 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)
@@ -88,6 +91,175 @@ void gatherFuncAndVarSyms( symbolAndClause.emplace_back(clause, *object.id()); } +int getComponentPlacementInParent( +const Fortran::semantics::Symbol *componentSym) { + const auto *derived = + componentSym->owner() + .derivedTypeSpec() + ->typeSymbol() + .detailsIf(); + assert(derived && + "expected derived type details when processing component symbol"); + int placement = 0; + for (auto t : derived->componentNames()) { +if (t == componentSym->name()) + return placement; +placement++; + } + return -1; +} + +std::optional +getCompObjOrNull(std::optional object, + Fortran::semantics::SemanticsContext &semaCtx) { + if (!object) +return std::nullopt; + + auto ref = evaluate::ExtractDataRef(*object.value().ref()); + if (!ref) +return std::nullopt; + + if (std::get_if(&ref->u)) +return object; + + auto baseObj = getBaseObject(object.value(), semaCtx); + if (!baseObj) +return std::nullopt; + + return getCompObjOrNull(baseObj.value(), semaCtx); +} + +llvm::SmallVector +generateMemberPlacementIndices(const Object &object, + Fortran::semantics::SemanticsContext &semaCtx) { + std::list indices; + auto compObj = getCompObjOrNull(object, semaCtx); + while (compObj) { +indices.push_front(getComponentPlacementInParent(compObj->id())); +compObj = +getCompObjOrNull(getBaseObject(compObj.value(), semaCtx), semaCtx); + } + + return llvm::SmallVector{std::begin(indices), std::end(indices)}; +} + +static void calculateShapeAndFillIndices( +llvm::SmallVectorImpl &shape, +llvm::SmallVector &memberPlacementData) { + shape.push_back(memberPlacementData.size()); + size_t largestIndicesSize = + std::max_element(memberPlacementData.begin(), memberPlacementData.end(), + [](auto a, auto b) { + return a.memberPlacementIndices.size() < +b.memberPlacementIndices.size(); + }) + ->memberPlacementIndices.size(); + shape.push_back(largestIndicesSize); + + // DenseElementsAttr expects a rectangular shape for the data, so all + // index lists have to be of the same length, this implaces -1 as filler + // values + for (auto &v : memberPlacementData) +if (v.memberPlacementIndices.size() < largestIndicesSize) { + auto *prevEnd = v.memberPlacementIndices.end(); + v.memberPlacementIndices.resize(largestIndicesSize); + std::fill(prevEnd, v.memberPlacementIndices.end(), -1); +} +} + +mlir::DenseIntElementsAttr createDenseElementsAttrFromIndices( +llvm::SmallVector &memberPlacementData, +fir::FirOpBuilder &builder) { + llvm::SmallVector shape; + calculateShapeAndFillIndices(shape, memberPlacementData); + + llvm::SmallVector indicesFlattened = std::accumulate( + memberPlacementData.begin(), memberPlacementData.end(), + llvm::SmallVector(), + [](llvm::SmallVector &x, OmpMapMemberIndicesData &y) { +x.insert(x.end(), y.memberPlacementIndices.begin(), + y.memberPlacementIndices.end()); +return x; + }); + + return mlir::DenseIntElementsAttr::get( + mlir::VectorType::get(llvm::ArrayRef(shape), +mlir::IntegerType::get(builder.getContext(), 32)), + llvm::ArrayRef(indicesFlattened)); +} + +void insertChildMapInfoIntoParent( +Fortran::lower::AbstractConverter &converter, +std::map> &parentMemberIndices, +llvm::SmallVectorImpl &mapOperands, +llvm::SmallVectorImpl *mapSymTypes, +llvm::SmallVectorImpl *mapSymLocs, +llvm::SmallVectorImpl *mapSymbols) { + for (auto indices : parentMemberIndices) { +bool parentExists = false; +size_t parentIdx; +for (parentIdx = 0; parentIdx < mapSymbols->size(); ++parentIdx) + if ((*mapSymbols)[parentIdx] == indices.first) { +parentExists = true; +break; + } + +if (parentExists) { + auto mapOp = mlir::dyn_cast( agozillon wrote: I like the idea of more information in my asserts, but happy to swap to it :-) https://github.com/llvm/llvm-project/pull/82853 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [GSYM][DWARF] Include end_sequence debug_line rows when looking up addr ranges (PR #89703)
dwblaikie wrote: Oh, sorry, right - that API should/might be used by `llvm-symbolizer` and the change might be visible through its behavior? https://github.com/llvm/llvm-project/pull/89703 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)
@@ -97,7 +269,7 @@ getOmpObjectSymbol(const Fortran::parser::OmpObject &ompObject) { if (auto *arrayEle = Fortran::parser::Unwrap( designator)) { - sym = GetFirstName(arrayEle->base).symbol; + sym = GetLastName(arrayEle->base).symbol; agozillon wrote: >From my understanding (and someone do please chime in if I am incorrect or >misunderstanding), it will get the far right symbol, whereas previously it >would get the far left symbol. So given the following: dtype1%dtype2%array[2:10] The getFirstName method would have retrieved "dtype1", not ideal as that's not what the ompObject is really referencing or what we care about in the case of unwrapping an array as it isn't the arrays symbol. In the case of getLastName, we'd end up with "array", which is more what we'd expect. As we never really used constructs like this with getOmpObjectSymbol before (from what I can tell at least) it wasn't noticeable I believe. As for array[2:10] either getFirstName or getLastName will resolve to "array". https://github.com/llvm/llvm-project/pull/82853 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [release/18.x][COFF][Aarch64] Add _InterlockedAdd64 intrinsic (#81849) (PR #89951)
efriedma-quic wrote: I think BuiltinsAArch64.def is part of clang's ABI, so changing it violates the backport rules. Otherwise, I'd be inclined to accept; it's kind of late to request, but it's low risk. https://github.com/llvm/llvm-project/pull/89951 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [bolt] Revise IDE folder structure (PR #89742)
https://github.com/rafaelauler approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/89742 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [bolt] Revise IDE folder structure (PR #89742)
https://github.com/dcci approved this pull request. https://github.com/llvm/llvm-project/pull/89742 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [flang][OpenMP] Support tasks' implicit firstprivate DSA (PR #85989)
https://github.com/luporl updated https://github.com/llvm/llvm-project/pull/85989 >From 94301e00239b789cf90d5291b1d733f0f2baab6c Mon Sep 17 00:00:00 2001 From: Leandro Lupori Date: Mon, 11 Mar 2024 16:47:47 -0300 Subject: [PATCH 1/2] [flang][OpenMP] Support tasks' implicit firstprivate DSA Handle implicit firstprivate DSAs on task generating constructs. Fixes https://github.com/llvm/llvm-project/issues/64480 --- flang/include/flang/Semantics/symbol.h| 3 +- .../lib/Lower/OpenMP/DataSharingProcessor.cpp | 114 +++- flang/lib/Lower/OpenMP/DataSharingProcessor.h | 11 +- flang/lib/Semantics/resolve-directives.cpp| 85 +- .../test/Lower/OpenMP/FIR/default-clause.f90 | 3 +- .../Lower/OpenMP/default-clause-byref.f90 | 4 +- flang/test/Lower/OpenMP/default-clause.f90| 4 +- flang/test/Lower/OpenMP/implicit-dsa.f90 | 275 ++ flang/test/Semantics/OpenMP/implicit-dsa.f90 | 158 ++ flang/test/Semantics/OpenMP/symbol08.f90 | 2 +- 10 files changed, 617 insertions(+), 42 deletions(-) create mode 100644 flang/test/Lower/OpenMP/implicit-dsa.f90 create mode 100644 flang/test/Semantics/OpenMP/implicit-dsa.f90 diff --git a/flang/include/flang/Semantics/symbol.h b/flang/include/flang/Semantics/symbol.h index 67153ffb3be9f6..34ac674614a695 100644 --- a/flang/include/flang/Semantics/symbol.h +++ b/flang/include/flang/Semantics/symbol.h @@ -740,7 +740,8 @@ class Symbol { OmpCommonBlock, OmpReduction, OmpAligned, OmpNontemporal, OmpAllocate, OmpDeclarativeAllocateDirective, OmpExecutableAllocateDirective, OmpDeclareSimd, OmpDeclareTarget, OmpThreadprivate, OmpDeclareReduction, - OmpFlushed, OmpCriticalLock, OmpIfSpecified, OmpNone, OmpPreDetermined); + OmpFlushed, OmpCriticalLock, OmpIfSpecified, OmpNone, OmpPreDetermined, + OmpImplicit); using Flags = common::EnumSet; const Scope &owner() const { return *owner_; } diff --git a/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp b/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp index 90c7e46dd183e3..792b3341ef03cb 100644 --- a/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp +++ b/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp @@ -26,8 +26,10 @@ namespace omp { void DataSharingProcessor::processStep1() { collectSymbolsForPrivatization(); collectDefaultSymbols(); + collectImplicitSymbols(); privatize(); defaultPrivatize(); + implicitPrivatize(); insertBarrier(); } @@ -268,16 +270,94 @@ void DataSharingProcessor::insertLastPrivateCompare(mlir::Operation *op) { firOpBuilder.restoreInsertionPoint(localInsPt); } +static const Fortran::parser::CharBlock * +getSource(const Fortran::semantics::SemanticsContext &semaCtx, + const Fortran::lower::pft::Evaluation &eval) { + const Fortran::parser::CharBlock *source = nullptr; + + auto ompConsVisit = [&](const Fortran::parser::OpenMPConstruct &x) { +std::visit(Fortran::common::visitors{ + [&](const Fortran::parser::OpenMPSectionsConstruct &x) { + source = &std::get<0>(x.t).source; + }, + [&](const Fortran::parser::OpenMPLoopConstruct &x) { + source = &std::get<0>(x.t).source; + }, + [&](const Fortran::parser::OpenMPBlockConstruct &x) { + source = &std::get<0>(x.t).source; + }, + [&](const Fortran::parser::OpenMPCriticalConstruct &x) { + source = &std::get<0>(x.t).source; + }, + [&](const Fortran::parser::OpenMPAtomicConstruct &x) { + std::visit([&](const auto &x) { source = &x.source; }, +x.u); + }, + [&](const auto &x) { source = &x.source; }, + }, + x.u); + }; + + eval.visit(Fortran::common::visitors{ + [&](const Fortran::parser::OpenMPConstruct &x) { ompConsVisit(x); }, + [&](const Fortran::parser::OpenMPDeclarativeConstruct &x) { +source = &x.source; + }, + [&](const Fortran::parser::OmpEndLoopDirective &x) { +source = &x.source; + }, + [&](const auto &x) {}, + }); + + return source; +} + void DataSharingProcessor::collectSymbols( -Fortran::semantics::Symbol::Flag flag) { - converter.collectSymbolSet(eval, defaultSymbols, flag, +Fortran::semantics::Symbol::Flag flag, +llvm::SetVector &symbols) { + // Collect all scopes associated with 'eval'. + llvm::SetVector clauseScopes; + std::function collectScopes = + [&](const Fortran::semantics::Scope *scope) { +clauseScopes.insert(scope); +for (const Fortran::semantics::Scope &child : scope->children()) + collectScopes(&child); + }; + const Fortran::parser::CharBlock *source = + clauses.empty() ? getSource(semaCtx, eval) : &clauses.front().source; + const Fortran::seman
[llvm-branch-commits] [flang] [flang][OpenMP] Support tasks' implicit firstprivate DSA (PR #85989)
@@ -2012,34 +2012,87 @@ void OmpAttributeVisitor::Post(const parser::Name &name) { } } } -std::vector defaultDSASymbols; + +// Implicitly determined DSAs +// OMP 5.2 5.1.1 - Variables Referenced in a Construct +Symbol *lastDeclSymbol = nullptr; +std::optional prevDSA; for (int dirDepth{0}; dirDepth < (int)dirContext_.size(); ++dirDepth) { DirContext &dirContext = dirContext_[dirDepth]; - bool hasDataSharingAttr{false}; + std::optional dsa; + for (auto symMap : dirContext.objectWithDSA) { // if the `symbol` already has a data-sharing attribute if (symMap.first->name() == name.symbol->name()) { - hasDataSharingAttr = true; + dsa = symMap.second; break; } } - if (hasDataSharingAttr) { -if (defaultDSASymbols.size()) - symbol = &MakeAssocSymbol(symbol->name(), *defaultDSASymbols.back(), + + // When handling each implicit rule, either a new private symbol is + // declared or the last declared symbol is used. + // In the latter case, it's necessary to insert a new symbol in the scope + // being processed, associated with the last declared symbol, to avoid + // "inheriting" the enclosing context's symbol and its flags. luporl wrote: I have expanded the explanation of why a new symbol is needed when inheriting the enclosing context's symbol. Please check if it is clear now. https://github.com/llvm/llvm-project/pull/85989 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)
@@ -22,6 +22,10 @@ namespace fir { class FirOpBuilder; } // namespace fir +namespace llvm::omp { +enum class OpenMPOffloadMappingFlags : uint64_t; +} // namespace llvm::omp agozillon wrote: It is no longer used! Thank you for pointing that out. https://github.com/llvm/llvm-project/pull/82853 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)
@@ -0,0 +1,260 @@ +//===- OMPMapInfoFinalization.cpp +//---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +//===--===// +/// \file +/// An OpenMP dialect related pass for FIR/HLFIR which performs some +/// pre-processing of MapInfoOp's after the module has been lowered to +/// finalize them. +/// +/// For example, it expands MapInfoOp's containing descriptor related +/// types (fir::BoxType's) into multiple MapInfoOp's containing the parent +/// descriptor and pointer member components for individual mapping, +/// treating the descriptor type as a record type for later lowering in the +/// OpenMP dialect. +/// +/// The pass also adds MapInfoOp's that are members of a parent object but are +/// not directly used in the body of a target region to it's BlockArgument list +/// to maintain consistency across all MapInfoOp's tied to a region directly or +/// indirectly via an parent object. +//===--===// + +#include "flang/Optimizer/Builder/FIRBuilder.h" +#include "flang/Optimizer/Dialect/FIRType.h" +#include "flang/Optimizer/Dialect/Support/KindMapping.h" +#include "flang/Optimizer/Transforms/Passes.h" +#include "mlir/Dialect/Func/IR/FuncOps.h" +#include "mlir/Dialect/OpenMP/OpenMPDialect.h" +#include "mlir/IR/BuiltinDialect.h" +#include "mlir/IR/BuiltinOps.h" +#include "mlir/IR/Operation.h" +#include "mlir/IR/SymbolTable.h" +#include "mlir/Pass/Pass.h" +#include "mlir/Support/LLVM.h" +#include "llvm/ADT/SmallPtrSet.h" +#include "llvm/Frontend/OpenMP/OMPConstants.h" +#include + +namespace fir { +#define GEN_PASS_DEF_OMPMAPINFOFINALIZATIONPASS +#include "flang/Optimizer/Transforms/Passes.h.inc" +} // namespace fir + +namespace { +class OMPMapInfoFinalizationPass +: public fir::impl::OMPMapInfoFinalizationPassBase< + OMPMapInfoFinalizationPass> { + + void genDescriptorMemberMaps(mlir::omp::MapInfoOp op, + fir::FirOpBuilder &builder, + mlir::Operation *target) { +mlir::Location loc = builder.getUnknownLoc(); +mlir::Value descriptor = op.getVarPtr(); + +// If we enter this function, but the mapped type itself is not the +// descriptor, then it's likely the address of the descriptor so we +// must retrieve the descriptor SSA. +if (!fir::isTypeWithDescriptor(op.getVarType())) { + if (auto addrOp = mlir::dyn_cast_if_present( + op.getVarPtr().getDefiningOp())) { +descriptor = addrOp.getVal(); + } +} + +// The fir::BoxOffsetOp only works with !fir.ref> types, as +// allowing it to access non-reference box operations can cause some +// problematic SSA IR. However, in the case of assumed shape's the type +// is not a !fir.ref, in these cases to retrieve the appropriate +// !fir.ref> to access the data we need to map we must +// perform an alloca and then store to it and retrieve the data from the new +// alloca. +if (mlir::isa(descriptor.getType())) { + mlir::OpBuilder::InsertPoint insPt = builder.saveInsertionPoint(); + builder.setInsertionPointToStart(builder.getAllocaBlock()); + auto alloca = builder.create(loc, descriptor.getType()); + builder.restoreInsertionPoint(insPt); + builder.create(loc, descriptor, alloca); + descriptor = alloca; +} + +mlir::Value baseAddrAddr = builder.create( +loc, descriptor, fir::BoxFieldAttr::base_addr); + +// Member of the descriptor pointing at the allocated data +mlir::Value baseAddr = builder.create( +loc, baseAddrAddr.getType(), descriptor, +mlir::TypeAttr::get(llvm::cast( +fir::unwrapRefType(baseAddrAddr.getType())) +.getElementType()), +baseAddrAddr, mlir::SmallVector{}, +mlir::DenseIntElementsAttr{}, op.getBounds(), +builder.getIntegerAttr(builder.getIntegerType(64, false), + op.getMapType().value()), +builder.getAttr( +mlir::omp::VariableCaptureKind::ByRef), +builder.getStringAttr("") /*name*/, +builder.getBoolAttr(false) /*partial_map*/); + +// TODO: map the addendum segment of the descriptor, similarly to the +// above base address/data pointer member. + +if (auto mapClauseOwner = +llvm::dyn_cast(target)) { + llvm::SmallVector newMapOps; + mlir::OperandRange mapOperandsArr = mapClauseOwner.getMapOperands(); + + for (size_t i = 0; i < mapOperandsArr.size(); ++i) { +if (mapOperandsArr[i] == op) { +
[llvm-branch-commits] [clang] [clang][CallGraphSection] Add type id metadata to indirect call and targets (PR #87573)
@@ -5687,6 +5688,39 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, AllocAlignAttrEmitter AllocAlignAttrEmitter(*this, TargetDecl, CallArgs); Attrs = AllocAlignAttrEmitter.TryEmitAsCallSiteAttribute(Attrs); + if (CGM.getCodeGenOpts().CallGraphSection) { +// FIXME: create operand bundle only for indirect calls, not for all + +assert((TargetDecl && TargetDecl->getFunctionType() || +Callee.getAbstractInfo().getCalleeFunctionProtoType()) && + "cannot find callsite type"); + +QualType CST; +if (TargetDecl && TargetDecl->getFunctionType()) + CST = QualType(TargetDecl->getFunctionType(), 0); +else if (const auto *FPT = + Callee.getAbstractInfo().getCalleeFunctionProtoType()) + CST = QualType(FPT, 0); + +if (!CST.isNull()) { + auto *TypeIdMD = CGM.CreateMetadataIdentifierGeneralized(CST); + auto *TypeIdMDVal = + llvm::MetadataAsValue::get(getLLVMContext(), TypeIdMD); + BundleList.emplace_back("type", TypeIdMDVal); +} + +// Set type identifier metadata of indirect calls for call graph section. +if (callOrInvoke && *callOrInvoke && (*callOrInvoke)->isIndirectCall()) { + if (const FunctionDecl *FD = dyn_cast_or_null(TargetDecl)) { +// Type id metadata is set only for C/C++ contexts. +if (dyn_cast(FD) || dyn_cast(FD) || +dyn_cast(FD)) { arsenm wrote: Use isa instead if you aren't going to use the pointer https://github.com/llvm/llvm-project/pull/87573 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)
@@ -88,6 +91,175 @@ void gatherFuncAndVarSyms( symbolAndClause.emplace_back(clause, *object.id()); } +int getComponentPlacementInParent( +const Fortran::semantics::Symbol *componentSym) { + const auto *derived = + componentSym->owner() + .derivedTypeSpec() + ->typeSymbol() + .detailsIf(); + assert(derived && + "expected derived type details when processing component symbol"); + int placement = 0; + for (auto t : derived->componentNames()) { +if (t == componentSym->name()) + return placement; +placement++; + } + return -1; +} + +std::optional +getCompObjOrNull(std::optional object, + Fortran::semantics::SemanticsContext &semaCtx) { + if (!object) +return std::nullopt; + + auto ref = evaluate::ExtractDataRef(*object.value().ref()); + if (!ref) +return std::nullopt; + + if (std::get_if(&ref->u)) +return object; + + auto baseObj = getBaseObject(object.value(), semaCtx); + if (!baseObj) +return std::nullopt; + + return getCompObjOrNull(baseObj.value(), semaCtx); +} + +llvm::SmallVector +generateMemberPlacementIndices(const Object &object, + Fortran::semantics::SemanticsContext &semaCtx) { + std::list indices; + auto compObj = getCompObjOrNull(object, semaCtx); + while (compObj) { +indices.push_front(getComponentPlacementInParent(compObj->id())); +compObj = +getCompObjOrNull(getBaseObject(compObj.value(), semaCtx), semaCtx); + } + + return llvm::SmallVector{std::begin(indices), std::end(indices)}; +} + +static void calculateShapeAndFillIndices( +llvm::SmallVectorImpl &shape, +llvm::SmallVector &memberPlacementData) { agozillon wrote: I've opted to not change these to llvm::ArrayRef's but rather llvm::SmallVectorImpl's, as ArrayRef doesn't seem to play particularly nicely with the resize and fill. https://github.com/llvm/llvm-project/pull/82853 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)
@@ -88,6 +91,175 @@ void gatherFuncAndVarSyms( symbolAndClause.emplace_back(clause, *object.id()); } +int getComponentPlacementInParent( +const Fortran::semantics::Symbol *componentSym) { + const auto *derived = + componentSym->owner() + .derivedTypeSpec() + ->typeSymbol() + .detailsIf(); + assert(derived && + "expected derived type details when processing component symbol"); + int placement = 0; + for (auto t : derived->componentNames()) { +if (t == componentSym->name()) + return placement; +placement++; + } + return -1; +} + +std::optional +getCompObjOrNull(std::optional object, + Fortran::semantics::SemanticsContext &semaCtx) { + if (!object) +return std::nullopt; + + auto ref = evaluate::ExtractDataRef(*object.value().ref()); + if (!ref) +return std::nullopt; + + if (std::get_if(&ref->u)) +return object; + + auto baseObj = getBaseObject(object.value(), semaCtx); + if (!baseObj) +return std::nullopt; + + return getCompObjOrNull(baseObj.value(), semaCtx); +} + +llvm::SmallVector agozillon wrote: Opted to take it in as an argument as opposed to a return type, as returning a local SmallVector to a SmallVectorImpl doesn't seem like it's allowed (perhaps I tried it incorrectly however, but I couldn't grep a case where it seemed done in LLVM, my grep capabilities are possibly lacking though) https://github.com/llvm/llvm-project/pull/82853 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [CIR] Add options to emit ClangIR and enable the ClangIR pipeline (PR #89030)
@@ -2876,6 +2876,15 @@ def flax_vector_conversions : Flag<["-"], "flax-vector-conversions">, Group, Group, HelpText<"Force linking the clang builtins runtime library">; + +/// ClangIR-specific options - BEGIN +def fclangir_enable : Flag<["-"], "fclangir-enable">, Visibility<[ClangOption, CC1Option]>, + Group, HelpText<"Use ClangIR pipeline to compile">, + MarshallingInfoFlag>; +def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>, + Group, HelpText<"Build ASTs and then lower to ClangIR, emit the .cir file">; bcardosolopes wrote: It mimics `-emit-llvm`. One caveat is that CIR isn't yet serializable, so it will emit textual output regardless. https://github.com/llvm/llvm-project/pull/89030 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [CIR] Add options to emit ClangIR and enable the ClangIR pipeline (PR #89030)
@@ -590,7 +596,7 @@ class FrontendOptions { EmitSymbolGraph(false), EmitExtensionSymbolGraphs(false), EmitSymbolGraphSymbolLabelsForTesting(false), EmitPrettySymbolGraphs(false), GenReducedBMI(false), -TimeTraceGranularity(500) {} +UseClangIRPipeline(), TimeTraceGranularity(500) {} bcardosolopes wrote: Oops! https://github.com/llvm/llvm-project/pull/89030 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [CIR] Add options to emit ClangIR and enable the ClangIR pipeline (PR #89030)
@@ -2876,6 +2876,15 @@ def flax_vector_conversions : Flag<["-"], "flax-vector-conversions">, Group, Group, HelpText<"Force linking the clang builtins runtime library">; + +/// ClangIR-specific options - BEGIN +def fclangir_enable : Flag<["-"], "fclangir-enable">, Visibility<[ClangOption, CC1Option]>, bcardosolopes wrote: Even better :) https://github.com/llvm/llvm-project/pull/89030 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/18.x: [X86] Fix miscompile in combineShiftRightArithmetic (PR #86728)
https://github.com/tstellar updated https://github.com/llvm/llvm-project/pull/86728 >From 76cbd417af50b444f5fbaa628b5a76064e6f10db Mon Sep 17 00:00:00 2001 From: Rose Date: Tue, 26 Mar 2024 16:34:09 -0400 Subject: [PATCH 1/2] [X86] Pre-commit tests (NFC) --- llvm/test/CodeGen/X86/sar_fold.ll | 41 +++ 1 file changed, 41 insertions(+) diff --git a/llvm/test/CodeGen/X86/sar_fold.ll b/llvm/test/CodeGen/X86/sar_fold.ll index 21655e19440afe..22ae8e8abd3eca 100644 --- a/llvm/test/CodeGen/X86/sar_fold.ll +++ b/llvm/test/CodeGen/X86/sar_fold.ll @@ -44,3 +44,44 @@ define i32 @shl24sar25(i32 %a) #0 { %2 = ashr exact i32 %1, 25 ret i32 %2 } + +define void @shl144sar48(ptr %p) #0 { +; CHECK-LABEL: shl144sar48: +; CHECK: # %bb.0: +; CHECK-NEXT:movl {{[0-9]+}}(%esp), %eax +; CHECK-NEXT:movswl (%eax), %ecx +; CHECK-NEXT:movl %ecx, %edx +; CHECK-NEXT:sarl $31, %edx +; CHECK-NEXT:shldl $2, %ecx, %edx +; CHECK-NEXT:shll $2, %ecx +; CHECK-NEXT:movl %ecx, 12(%eax) +; CHECK-NEXT:movl %edx, 16(%eax) +; CHECK-NEXT:movl $0, 8(%eax) +; CHECK-NEXT:movl $0, 4(%eax) +; CHECK-NEXT:movl $0, (%eax) +; CHECK-NEXT:retl + %a = load i160, ptr %p + %1 = shl i160 %a, 144 + %2 = ashr exact i160 %1, 46 + store i160 %2, ptr %p + ret void +} + +define void @shl144sar2(ptr %p) #0 { +; CHECK-LABEL: shl144sar2: +; CHECK: # %bb.0: +; CHECK-NEXT:movl {{[0-9]+}}(%esp), %eax +; CHECK-NEXT:movswl (%eax), %ecx +; CHECK-NEXT:sarl $31, %ecx +; CHECK-NEXT:movl %ecx, 16(%eax) +; CHECK-NEXT:movl %ecx, 8(%eax) +; CHECK-NEXT:movl %ecx, 12(%eax) +; CHECK-NEXT:movl %ecx, 4(%eax) +; CHECK-NEXT:movl %ecx, (%eax) +; CHECK-NEXT:retl + %a = load i160, ptr %p + %1 = shl i160 %a, 144 + %2 = ashr exact i160 %1, 2 + store i160 %2, ptr %p + ret void +} >From 111ae4509c96878058cb02e7841c7afcad14875b Mon Sep 17 00:00:00 2001 From: Rose Date: Tue, 26 Mar 2024 16:38:46 -0400 Subject: [PATCH 2/2] [X86] Fix miscompile in combineShiftRightArithmetic When folding (ashr (shl, x, c1), c2) we need to treat c1 and c2 as unsigned to find out if the combined shift should be a left or right shift. Also do an early out during pre-legalization in case c1 and c2 has different types, as that otherwise complicated the comparison of c1 and c2 a bit. (cherry picked from commit 3e6e54eb795ce7a1ccd47df8c22fc08125a6) --- llvm/lib/Target/X86/X86ISelLowering.cpp | 29 ++--- llvm/test/CodeGen/X86/sar_fold.ll | 10 - 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 9e64726fb6fff7..71fc6b5047eaa9 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -47035,10 +47035,13 @@ static SDValue combineShiftRightArithmetic(SDNode *N, SelectionDAG &DAG, if (SDValue V = combineShiftToPMULH(N, DAG, Subtarget)) return V; - // fold (ashr (shl, a, [56,48,32,24,16]), SarConst) - // into (shl, (sext (a), [56,48,32,24,16] - SarConst)) or - // into (lshr, (sext (a), SarConst - [56,48,32,24,16])) - // depending on sign of (SarConst - [56,48,32,24,16]) + // fold (SRA (SHL X, ShlConst), SraConst) + // into (SHL (sext_in_reg X), ShlConst - SraConst) + // or (sext_in_reg X) + // or (SRA (sext_in_reg X), SraConst - ShlConst) + // depending on relation between SraConst and ShlConst. + // We only do this if (Size - ShlConst) is equal to 8, 16 or 32. That allows + // us to do the sext_in_reg from corresponding bit. // sexts in X86 are MOVs. The MOVs have the same code size // as above SHIFTs (only SHIFT on 1 has lower code size). @@ -47054,29 +47057,29 @@ static SDValue combineShiftRightArithmetic(SDNode *N, SelectionDAG &DAG, SDValue N00 = N0.getOperand(0); SDValue N01 = N0.getOperand(1); APInt ShlConst = N01->getAsAPIntVal(); - APInt SarConst = N1->getAsAPIntVal(); + APInt SraConst = N1->getAsAPIntVal(); EVT CVT = N1.getValueType(); - if (SarConst.isNegative()) + if (CVT != N01.getValueType()) +return SDValue(); + if (SraConst.isNegative()) return SDValue(); for (MVT SVT : { MVT::i8, MVT::i16, MVT::i32 }) { unsigned ShiftSize = SVT.getSizeInBits(); -// skipping types without corresponding sext/zext and -// ShlConst that is not one of [56,48,32,24,16] +// Only deal with (Size - ShlConst) being equal to 8, 16 or 32. if (ShiftSize >= Size || ShlConst != Size - ShiftSize) continue; SDLoc DL(N); SDValue NN = DAG.getNode(ISD::SIGN_EXTEND_INREG, DL, VT, N00, DAG.getValueType(SVT)); -SarConst = SarConst - (Size - ShiftSize); -if (SarConst == 0) +if (SraConst.eq(ShlConst)) return NN; -if (SarConst.isNegative()) +if (SraConst.ult(ShlConst)) return DAG.getNode(ISD::SHL, DL, VT, NN, - DAG.getConstant(-SarConst, DL, CVT)); +
[llvm-branch-commits] [llvm] 76cbd41 - [X86] Pre-commit tests (NFC)
Author: Rose Date: 2024-04-24T15:11:22-07:00 New Revision: 76cbd417af50b444f5fbaa628b5a76064e6f10db URL: https://github.com/llvm/llvm-project/commit/76cbd417af50b444f5fbaa628b5a76064e6f10db DIFF: https://github.com/llvm/llvm-project/commit/76cbd417af50b444f5fbaa628b5a76064e6f10db.diff LOG: [X86] Pre-commit tests (NFC) Added: Modified: llvm/test/CodeGen/X86/sar_fold.ll Removed: diff --git a/llvm/test/CodeGen/X86/sar_fold.ll b/llvm/test/CodeGen/X86/sar_fold.ll index 21655e19440afe..22ae8e8abd3eca 100644 --- a/llvm/test/CodeGen/X86/sar_fold.ll +++ b/llvm/test/CodeGen/X86/sar_fold.ll @@ -44,3 +44,44 @@ define i32 @shl24sar25(i32 %a) #0 { %2 = ashr exact i32 %1, 25 ret i32 %2 } + +define void @shl144sar48(ptr %p) #0 { +; CHECK-LABEL: shl144sar48: +; CHECK: # %bb.0: +; CHECK-NEXT:movl {{[0-9]+}}(%esp), %eax +; CHECK-NEXT:movswl (%eax), %ecx +; CHECK-NEXT:movl %ecx, %edx +; CHECK-NEXT:sarl $31, %edx +; CHECK-NEXT:shldl $2, %ecx, %edx +; CHECK-NEXT:shll $2, %ecx +; CHECK-NEXT:movl %ecx, 12(%eax) +; CHECK-NEXT:movl %edx, 16(%eax) +; CHECK-NEXT:movl $0, 8(%eax) +; CHECK-NEXT:movl $0, 4(%eax) +; CHECK-NEXT:movl $0, (%eax) +; CHECK-NEXT:retl + %a = load i160, ptr %p + %1 = shl i160 %a, 144 + %2 = ashr exact i160 %1, 46 + store i160 %2, ptr %p + ret void +} + +define void @shl144sar2(ptr %p) #0 { +; CHECK-LABEL: shl144sar2: +; CHECK: # %bb.0: +; CHECK-NEXT:movl {{[0-9]+}}(%esp), %eax +; CHECK-NEXT:movswl (%eax), %ecx +; CHECK-NEXT:sarl $31, %ecx +; CHECK-NEXT:movl %ecx, 16(%eax) +; CHECK-NEXT:movl %ecx, 8(%eax) +; CHECK-NEXT:movl %ecx, 12(%eax) +; CHECK-NEXT:movl %ecx, 4(%eax) +; CHECK-NEXT:movl %ecx, (%eax) +; CHECK-NEXT:retl + %a = load i160, ptr %p + %1 = shl i160 %a, 144 + %2 = ashr exact i160 %1, 2 + store i160 %2, ptr %p + ret void +} ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 111ae45 - [X86] Fix miscompile in combineShiftRightArithmetic
Author: Rose Date: 2024-04-24T15:11:22-07:00 New Revision: 111ae4509c96878058cb02e7841c7afcad14875b URL: https://github.com/llvm/llvm-project/commit/111ae4509c96878058cb02e7841c7afcad14875b DIFF: https://github.com/llvm/llvm-project/commit/111ae4509c96878058cb02e7841c7afcad14875b.diff LOG: [X86] Fix miscompile in combineShiftRightArithmetic When folding (ashr (shl, x, c1), c2) we need to treat c1 and c2 as unsigned to find out if the combined shift should be a left or right shift. Also do an early out during pre-legalization in case c1 and c2 has different types, as that otherwise complicated the comparison of c1 and c2 a bit. (cherry picked from commit 3e6e54eb795ce7a1ccd47df8c22fc08125a6) Added: Modified: llvm/lib/Target/X86/X86ISelLowering.cpp llvm/test/CodeGen/X86/sar_fold.ll Removed: diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 9e64726fb6fff7..71fc6b5047eaa9 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -47035,10 +47035,13 @@ static SDValue combineShiftRightArithmetic(SDNode *N, SelectionDAG &DAG, if (SDValue V = combineShiftToPMULH(N, DAG, Subtarget)) return V; - // fold (ashr (shl, a, [56,48,32,24,16]), SarConst) - // into (shl, (sext (a), [56,48,32,24,16] - SarConst)) or - // into (lshr, (sext (a), SarConst - [56,48,32,24,16])) - // depending on sign of (SarConst - [56,48,32,24,16]) + // fold (SRA (SHL X, ShlConst), SraConst) + // into (SHL (sext_in_reg X), ShlConst - SraConst) + // or (sext_in_reg X) + // or (SRA (sext_in_reg X), SraConst - ShlConst) + // depending on relation between SraConst and ShlConst. + // We only do this if (Size - ShlConst) is equal to 8, 16 or 32. That allows + // us to do the sext_in_reg from corresponding bit. // sexts in X86 are MOVs. The MOVs have the same code size // as above SHIFTs (only SHIFT on 1 has lower code size). @@ -47054,29 +47057,29 @@ static SDValue combineShiftRightArithmetic(SDNode *N, SelectionDAG &DAG, SDValue N00 = N0.getOperand(0); SDValue N01 = N0.getOperand(1); APInt ShlConst = N01->getAsAPIntVal(); - APInt SarConst = N1->getAsAPIntVal(); + APInt SraConst = N1->getAsAPIntVal(); EVT CVT = N1.getValueType(); - if (SarConst.isNegative()) + if (CVT != N01.getValueType()) +return SDValue(); + if (SraConst.isNegative()) return SDValue(); for (MVT SVT : { MVT::i8, MVT::i16, MVT::i32 }) { unsigned ShiftSize = SVT.getSizeInBits(); -// skipping types without corresponding sext/zext and -// ShlConst that is not one of [56,48,32,24,16] +// Only deal with (Size - ShlConst) being equal to 8, 16 or 32. if (ShiftSize >= Size || ShlConst != Size - ShiftSize) continue; SDLoc DL(N); SDValue NN = DAG.getNode(ISD::SIGN_EXTEND_INREG, DL, VT, N00, DAG.getValueType(SVT)); -SarConst = SarConst - (Size - ShiftSize); -if (SarConst == 0) +if (SraConst.eq(ShlConst)) return NN; -if (SarConst.isNegative()) +if (SraConst.ult(ShlConst)) return DAG.getNode(ISD::SHL, DL, VT, NN, - DAG.getConstant(-SarConst, DL, CVT)); + DAG.getConstant(ShlConst - SraConst, DL, CVT)); return DAG.getNode(ISD::SRA, DL, VT, NN, - DAG.getConstant(SarConst, DL, CVT)); + DAG.getConstant(SraConst - ShlConst, DL, CVT)); } return SDValue(); } diff --git a/llvm/test/CodeGen/X86/sar_fold.ll b/llvm/test/CodeGen/X86/sar_fold.ll index 22ae8e8abd3eca..0f1396954b03a1 100644 --- a/llvm/test/CodeGen/X86/sar_fold.ll +++ b/llvm/test/CodeGen/X86/sar_fold.ll @@ -72,12 +72,12 @@ define void @shl144sar2(ptr %p) #0 { ; CHECK: # %bb.0: ; CHECK-NEXT:movl {{[0-9]+}}(%esp), %eax ; CHECK-NEXT:movswl (%eax), %ecx -; CHECK-NEXT:sarl $31, %ecx +; CHECK-NEXT:shll $14, %ecx ; CHECK-NEXT:movl %ecx, 16(%eax) -; CHECK-NEXT:movl %ecx, 8(%eax) -; CHECK-NEXT:movl %ecx, 12(%eax) -; CHECK-NEXT:movl %ecx, 4(%eax) -; CHECK-NEXT:movl %ecx, (%eax) +; CHECK-NEXT:movl $0, 8(%eax) +; CHECK-NEXT:movl $0, 12(%eax) +; CHECK-NEXT:movl $0, 4(%eax) +; CHECK-NEXT:movl $0, (%eax) ; CHECK-NEXT:retl %a = load i160, ptr %p %1 = shl i160 %a, 144 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/18.x: [X86] Fix miscompile in combineShiftRightArithmetic (PR #86728)
https://github.com/tstellar closed https://github.com/llvm/llvm-project/pull/86728 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [CIR] Add options to emit ClangIR and enable the ClangIR pipeline (PR #89030)
@@ -2876,6 +2876,15 @@ def flax_vector_conversions : Flag<["-"], "flax-vector-conversions">, Group, Group, HelpText<"Force linking the clang builtins runtime library">; + +/// ClangIR-specific options - BEGIN +def fclangir_enable : Flag<["-"], "fclangir-enable">, Visibility<[ClangOption, CC1Option]>, + Group, HelpText<"Use ClangIR pipeline to compile">, + MarshallingInfoFlag>; +def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>, bcardosolopes wrote: My preference is to match current `-emit-llvm` behavior (i.e. be a driver level flag). It makes it convenient for us to just replace `-emit-llvm` with `-emit-cir` in workflows that currently expect LLVM output. If someone fixes `-emit-llvm` someday (which I find unlikely), we could then do the same for CIR. If this is a over my dead body argument for you, then whatever is fine, just wanna make sure I express what I believe is the right approach. https://github.com/llvm/llvm-project/pull/89030 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [OpenMP][MLIR] Add new arguments to map_info to help support record type maps (PR #82851)
https://github.com/agozillon updated https://github.com/llvm/llvm-project/pull/82851 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [OpenMP][MLIR] Add new arguments to map_info to help support record type maps (PR #82851)
https://github.com/agozillon updated https://github.com/llvm/llvm-project/pull/82851 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)
https://github.com/agozillon updated https://github.com/llvm/llvm-project/pull/82852 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)
https://github.com/agozillon updated https://github.com/llvm/llvm-project/pull/82852 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)
https://github.com/agozillon updated https://github.com/llvm/llvm-project/pull/82853 >From 21b05eee943e4f1ad20fcd8f30bd14a0a3317db6 Mon Sep 17 00:00:00 2001 From: Andrew Gozillon Date: Fri, 15 Mar 2024 14:13:30 -0500 Subject: [PATCH] update with minor tidying up Created using spr 1.3.4 --- flang/lib/Lower/OpenMP/Utils.cpp | 2 +- flang/lib/Lower/OpenMP/Utils.h| 2 -- flang/lib/Optimizer/Transforms/CMakeLists.txt | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/flang/lib/Lower/OpenMP/Utils.cpp b/flang/lib/Lower/OpenMP/Utils.cpp index 60aea9f5b70aba..18728e2c4c1b06 100644 --- a/flang/lib/Lower/OpenMP/Utils.cpp +++ b/flang/lib/Lower/OpenMP/Utils.cpp @@ -13,7 +13,6 @@ #include "Utils.h" #include "Clauses.h" -#include #include #include #include @@ -22,6 +21,7 @@ #include #include +#include #include llvm::cl::opt treatIndexAsSection( diff --git a/flang/lib/Lower/OpenMP/Utils.h b/flang/lib/Lower/OpenMP/Utils.h index f45e4490c2abe7..942dd4c12d87b6 100644 --- a/flang/lib/Lower/OpenMP/Utils.h +++ b/flang/lib/Lower/OpenMP/Utils.h @@ -14,7 +14,6 @@ #include "mlir/IR/Location.h" #include "mlir/IR/Value.h" #include "llvm/Support/CommandLine.h" -#include extern llvm::cl::opt treatIndexAsSection; extern llvm::cl::opt enableDelayedPrivatization; @@ -36,7 +35,6 @@ class Symbol; namespace parser { struct OmpObject; struct OmpObjectList; -struct Designator; } // namespace parser namespace lower { diff --git a/flang/lib/Optimizer/Transforms/CMakeLists.txt b/flang/lib/Optimizer/Transforms/CMakeLists.txt index ce5ce3ed1bc48d..63fbe2a0658d83 100644 --- a/flang/lib/Optimizer/Transforms/CMakeLists.txt +++ b/flang/lib/Optimizer/Transforms/CMakeLists.txt @@ -17,8 +17,8 @@ add_flang_library(FIRTransforms AddDebugFoundation.cpp PolymorphicOpConversion.cpp LoopVersioning.cpp - OMPMapInfoFinalization.cpp OMPFunctionFiltering.cpp + OMPMapInfoFinalization.cpp OMPMarkDeclareTarget.cpp VScaleAttr.cpp FunctionAttr.cpp ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)
https://github.com/agozillon updated https://github.com/llvm/llvm-project/pull/82853 >From 21b05eee943e4f1ad20fcd8f30bd14a0a3317db6 Mon Sep 17 00:00:00 2001 From: Andrew Gozillon Date: Fri, 15 Mar 2024 14:13:30 -0500 Subject: [PATCH] update with minor tidying up Created using spr 1.3.4 --- flang/lib/Lower/OpenMP/Utils.cpp | 2 +- flang/lib/Lower/OpenMP/Utils.h| 2 -- flang/lib/Optimizer/Transforms/CMakeLists.txt | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/flang/lib/Lower/OpenMP/Utils.cpp b/flang/lib/Lower/OpenMP/Utils.cpp index 60aea9f5b70aba..18728e2c4c1b06 100644 --- a/flang/lib/Lower/OpenMP/Utils.cpp +++ b/flang/lib/Lower/OpenMP/Utils.cpp @@ -13,7 +13,6 @@ #include "Utils.h" #include "Clauses.h" -#include #include #include #include @@ -22,6 +21,7 @@ #include #include +#include #include llvm::cl::opt treatIndexAsSection( diff --git a/flang/lib/Lower/OpenMP/Utils.h b/flang/lib/Lower/OpenMP/Utils.h index f45e4490c2abe7..942dd4c12d87b6 100644 --- a/flang/lib/Lower/OpenMP/Utils.h +++ b/flang/lib/Lower/OpenMP/Utils.h @@ -14,7 +14,6 @@ #include "mlir/IR/Location.h" #include "mlir/IR/Value.h" #include "llvm/Support/CommandLine.h" -#include extern llvm::cl::opt treatIndexAsSection; extern llvm::cl::opt enableDelayedPrivatization; @@ -36,7 +35,6 @@ class Symbol; namespace parser { struct OmpObject; struct OmpObjectList; -struct Designator; } // namespace parser namespace lower { diff --git a/flang/lib/Optimizer/Transforms/CMakeLists.txt b/flang/lib/Optimizer/Transforms/CMakeLists.txt index ce5ce3ed1bc48d..63fbe2a0658d83 100644 --- a/flang/lib/Optimizer/Transforms/CMakeLists.txt +++ b/flang/lib/Optimizer/Transforms/CMakeLists.txt @@ -17,8 +17,8 @@ add_flang_library(FIRTransforms AddDebugFoundation.cpp PolymorphicOpConversion.cpp LoopVersioning.cpp - OMPMapInfoFinalization.cpp OMPFunctionFiltering.cpp + OMPMapInfoFinalization.cpp OMPMarkDeclareTarget.cpp VScaleAttr.cpp FunctionAttr.cpp ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)
agozillon wrote: Performed a rebase across the entire PR stack (my appologies, I forgot that might make the review a little more irritating before I performed it), and made an attempt to address all reviewer comments and where things didn't quite work as expected left replies on the comments. https://github.com/llvm/llvm-project/pull/82853 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/18.x: [GlobalISel] Fix fewerElementsVectorPhi to insert after G_PHIs (#87927) (PR #89240)
https://github.com/tstellar updated https://github.com/llvm/llvm-project/pull/89240 >From fb865928c8e01c8179d253c4ceb285d3a9f3a719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Ferenc=20Szab=C3=B3?= <30732159+dfsz...@users.noreply.github.com> Date: Mon, 15 Apr 2024 11:01:55 +0200 Subject: [PATCH] [GlobalISel] Fix fewerElementsVectorPhi to insert after G_PHIs (#87927) Currently the inserted mergelike instructions will be inserted at the location of the G_PHI. Seems like the behaviour was correct before, but the rework done in https://reviews.llvm.org/D114198 forgot to include the part which makes sure the instructions will be inserted after all the G_PHIs. (cherry picked from commit 2347020e4ce62ee7c7378824dc6ad2b94917a638) --- llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp | 4 llvm/unittests/CodeGen/GlobalISel/LegalizerHelperTest.cpp | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp index c0c22e36004f72..47d045ac48171e 100644 --- a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp +++ b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp @@ -4180,6 +4180,10 @@ LegalizerHelper::fewerElementsVectorPhi(GenericMachineInstr &MI, } } + // Set the insert point after the existing PHIs + MachineBasicBlock &MBB = *MI.getParent(); + MIRBuilder.setInsertPt(MBB, MBB.getFirstNonPHI()); + // Merge small outputs into MI's def. if (NumLeftovers) { mergeMixedSubvectors(MI.getReg(0), OutputRegs); diff --git a/llvm/unittests/CodeGen/GlobalISel/LegalizerHelperTest.cpp b/llvm/unittests/CodeGen/GlobalISel/LegalizerHelperTest.cpp index d7876b7ce87490..531360a697039c 100644 --- a/llvm/unittests/CodeGen/GlobalISel/LegalizerHelperTest.cpp +++ b/llvm/unittests/CodeGen/GlobalISel/LegalizerHelperTest.cpp @@ -1556,12 +1556,12 @@ TEST_F(AArch64GISelMITest, FewerElementsPhi) { CHECK: [[PHI0:%[0-9]+]]:_(<2 x s32>) = G_PHI [[INITVAL_E01]]:_(<2 x s32>), %bb.0, [[MIDVAL_E01]]:_(<2 x s32>), %bb.1 CHECK: [[PHI1:%[0-9]+]]:_(<2 x s32>) = G_PHI [[INITVAL_E23]]:_(<2 x s32>), %bb.0, [[MIDVAL_E23]]:_(<2 x s32>), %bb.1 CHECK: [[PHI2:%[0-9]+]]:_(s32) = G_PHI [[INITVAL_E4]]:_(s32), %bb.0, [[MIDVAL_E4]]:_(s32), %bb.1 - CHECK: [[UNMERGE0:%[0-9]+]]:_(s32), [[UNMERGE1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[PHI0]]:_(<2 x s32>) - CHECK: [[UNMERGE2:%[0-9]+]]:_(s32), [[UNMERGE3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[PHI1]]:_(<2 x s32>) - CHECK: [[BV:%[0-9]+]]:_(<5 x s32>) = G_BUILD_VECTOR [[UNMERGE0]]:_(s32), [[UNMERGE1]]:_(s32), [[UNMERGE2]]:_(s32), [[UNMERGE3]]:_(s32), [[PHI2]]:_(s32) CHECK: [[OTHER_PHI:%[0-9]+]]:_(s64) = G_PHI + CHECK: [[UNMERGE0:%[0-9]+]]:_(s32), [[UNMERGE1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[PHI0]]:_(<2 x s32>) + CHECK: [[UNMERGE2:%[0-9]+]]:_(s32), [[UNMERGE3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[PHI1]]:_(<2 x s32>) + CHECK: [[BV:%[0-9]+]]:_(<5 x s32>) = G_BUILD_VECTOR [[UNMERGE0]]:_(s32), [[UNMERGE1]]:_(s32), [[UNMERGE2]]:_(s32), [[UNMERGE3]]:_(s32), [[PHI2]]:_(s32) CHECK: [[USE_OP:%[0-9]+]]:_(<5 x s32>) = G_AND [[BV]]:_, [[BV]]:_ )"; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] fb86592 - [GlobalISel] Fix fewerElementsVectorPhi to insert after G_PHIs (#87927)
Author: Dávid Ferenc Szabó Date: 2024-04-24T15:28:57-07:00 New Revision: fb865928c8e01c8179d253c4ceb285d3a9f3a719 URL: https://github.com/llvm/llvm-project/commit/fb865928c8e01c8179d253c4ceb285d3a9f3a719 DIFF: https://github.com/llvm/llvm-project/commit/fb865928c8e01c8179d253c4ceb285d3a9f3a719.diff LOG: [GlobalISel] Fix fewerElementsVectorPhi to insert after G_PHIs (#87927) Currently the inserted mergelike instructions will be inserted at the location of the G_PHI. Seems like the behaviour was correct before, but the rework done in https://reviews.llvm.org/D114198 forgot to include the part which makes sure the instructions will be inserted after all the G_PHIs. (cherry picked from commit 2347020e4ce62ee7c7378824dc6ad2b94917a638) Added: Modified: llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp llvm/unittests/CodeGen/GlobalISel/LegalizerHelperTest.cpp Removed: diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp index c0c22e36004f72..47d045ac48171e 100644 --- a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp +++ b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp @@ -4180,6 +4180,10 @@ LegalizerHelper::fewerElementsVectorPhi(GenericMachineInstr &MI, } } + // Set the insert point after the existing PHIs + MachineBasicBlock &MBB = *MI.getParent(); + MIRBuilder.setInsertPt(MBB, MBB.getFirstNonPHI()); + // Merge small outputs into MI's def. if (NumLeftovers) { mergeMixedSubvectors(MI.getReg(0), OutputRegs); diff --git a/llvm/unittests/CodeGen/GlobalISel/LegalizerHelperTest.cpp b/llvm/unittests/CodeGen/GlobalISel/LegalizerHelperTest.cpp index d7876b7ce87490..531360a697039c 100644 --- a/llvm/unittests/CodeGen/GlobalISel/LegalizerHelperTest.cpp +++ b/llvm/unittests/CodeGen/GlobalISel/LegalizerHelperTest.cpp @@ -1556,12 +1556,12 @@ TEST_F(AArch64GISelMITest, FewerElementsPhi) { CHECK: [[PHI0:%[0-9]+]]:_(<2 x s32>) = G_PHI [[INITVAL_E01]]:_(<2 x s32>), %bb.0, [[MIDVAL_E01]]:_(<2 x s32>), %bb.1 CHECK: [[PHI1:%[0-9]+]]:_(<2 x s32>) = G_PHI [[INITVAL_E23]]:_(<2 x s32>), %bb.0, [[MIDVAL_E23]]:_(<2 x s32>), %bb.1 CHECK: [[PHI2:%[0-9]+]]:_(s32) = G_PHI [[INITVAL_E4]]:_(s32), %bb.0, [[MIDVAL_E4]]:_(s32), %bb.1 - CHECK: [[UNMERGE0:%[0-9]+]]:_(s32), [[UNMERGE1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[PHI0]]:_(<2 x s32>) - CHECK: [[UNMERGE2:%[0-9]+]]:_(s32), [[UNMERGE3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[PHI1]]:_(<2 x s32>) - CHECK: [[BV:%[0-9]+]]:_(<5 x s32>) = G_BUILD_VECTOR [[UNMERGE0]]:_(s32), [[UNMERGE1]]:_(s32), [[UNMERGE2]]:_(s32), [[UNMERGE3]]:_(s32), [[PHI2]]:_(s32) CHECK: [[OTHER_PHI:%[0-9]+]]:_(s64) = G_PHI + CHECK: [[UNMERGE0:%[0-9]+]]:_(s32), [[UNMERGE1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[PHI0]]:_(<2 x s32>) + CHECK: [[UNMERGE2:%[0-9]+]]:_(s32), [[UNMERGE3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[PHI1]]:_(<2 x s32>) + CHECK: [[BV:%[0-9]+]]:_(<5 x s32>) = G_BUILD_VECTOR [[UNMERGE0]]:_(s32), [[UNMERGE1]]:_(s32), [[UNMERGE2]]:_(s32), [[UNMERGE3]]:_(s32), [[PHI2]]:_(s32) CHECK: [[USE_OP:%[0-9]+]]:_(<5 x s32>) = G_AND [[BV]]:_, [[BV]]:_ )"; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/18.x: [GlobalISel] Fix fewerElementsVectorPhi to insert after G_PHIs (#87927) (PR #89240)
https://github.com/tstellar closed https://github.com/llvm/llvm-project/pull/89240 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] 21efbd2 - Revert "[MC] Rename temporary symbols of empty name to ".L0 " (#89693)"
Author: Mehdi Amini Date: 2024-04-25T00:51:18+02:00 New Revision: 21efbd229cb6b7341ab4575f71870492eba1fbf4 URL: https://github.com/llvm/llvm-project/commit/21efbd229cb6b7341ab4575f71870492eba1fbf4 DIFF: https://github.com/llvm/llvm-project/commit/21efbd229cb6b7341ab4575f71870492eba1fbf4.diff LOG: Revert "[MC] Rename temporary symbols of empty name to ".L0 " (#89693)" This reverts commit 96c45a7fa12619c3abd6b81effe4c80f0916b78b. Added: llvm/test/DebugInfo/Symbolize/ELF/riscv-empty-name-symbol.s Modified: lld/test/ELF/mips-eh_frame-pic.s llvm/include/llvm/Object/ELFObjectFile.h llvm/lib/MC/ELFObjectWriter.cpp llvm/test/CodeGen/RISCV/fixups-diff.ll llvm/test/DebugInfo/LoongArch/dwarf-loongarch-relocs.ll llvm/test/DebugInfo/RISCV/dwarf-riscv-relocs.ll llvm/test/DebugInfo/RISCV/relax-debug-frame.ll llvm/test/ExecutionEngine/JITLink/RISCV/anonymous_symbol.s llvm/test/MC/ELF/RISCV/gen-dwarf.s llvm/test/MC/RISCV/cfi-advance.s llvm/test/MC/RISCV/fde-reloc.s llvm/test/MC/RISCV/scoped-relaxation.s Removed: llvm/test/DebugInfo/Symbolize/ELF/riscv-temporary-symbol.s diff --git a/lld/test/ELF/mips-eh_frame-pic.s b/lld/test/ELF/mips-eh_frame-pic.s index c04dbdf57b08ad..a84c36b0e5ecdb 100644 --- a/lld/test/ELF/mips-eh_frame-pic.s +++ b/lld/test/ELF/mips-eh_frame-pic.s @@ -36,8 +36,8 @@ # RELOCS:.rel{{a?}}.eh_frame { # ABS32-RELOCS-NEXT: 0x1C R_MIPS_32 .text # ABS64-RELOCS-NEXT: 0x1C R_MIPS_64/R_MIPS_NONE/R_MIPS_NONE .text -# PIC64-RELOCS-NEXT: 0x1C R_MIPS_PC32/R_MIPS_NONE/R_MIPS_NONE .L0 -# PIC32-RELOCS-NEXT: 0x1C R_MIPS_PC32 .L0 +# PIC64-RELOCS-NEXT: 0x1C R_MIPS_PC32/R_MIPS_NONE/R_MIPS_NONE +# PIC32-RELOCS-NEXT: 0x1C R_MIPS_PC32 # RELOCS-NEXT: } # ABS64-EH-FRAME: Augmentation data: 0C diff --git a/llvm/include/llvm/Object/ELFObjectFile.h b/llvm/include/llvm/Object/ELFObjectFile.h index 4494d9b96189bc..1d457be93741f2 100644 --- a/llvm/include/llvm/Object/ELFObjectFile.h +++ b/llvm/include/llvm/Object/ELFObjectFile.h @@ -801,8 +801,9 @@ Expected ELFObjectFile::getSymbolFlags(DataRefImpl Sym) const { } else if (EF.getHeader().e_machine == ELF::EM_RISCV) { if (Expected NameOrErr = getSymbolName(Sym)) { StringRef Name = *NameOrErr; - // Mark fake labels (used for label diff erences) and mapping symbols. - if (Name == ".L0 " || Name.starts_with("$d") || Name.starts_with("$x")) + // Mark empty name symbols (used for label diff erences) and mapping + // symbols. + if (Name.empty() || Name.starts_with("$d") || Name.starts_with("$x")) Result |= SymbolRef::SF_FormatSpecific; } else { // TODO: Actually report errors helpfully. diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp index b8ef2654ed6e3b..005521bad6e014 100644 --- a/llvm/lib/MC/ELFObjectWriter.cpp +++ b/llvm/lib/MC/ELFObjectWriter.cpp @@ -725,13 +725,7 @@ void ELFWriter::computeSymbolTable( HasLargeSectionIndex = true; } -// Temporary symbols generated for certain assembler features (.eh_frame, -// .debug_line) of an empty name may be referenced by relocations due to -// linker relaxation. Rename them to ".L0 " to match the gas fake label name -// and allow ld/objcopy --discard-locals to discard such symbols. StringRef Name = Symbol.getName(); -if (Name.empty()) - Name = ".L0 "; // Sections have their own string table if (Symbol.getType() != ELF::STT_SECTION) { diff --git a/llvm/test/CodeGen/RISCV/fixups- diff .ll b/llvm/test/CodeGen/RISCV/fixups- diff .ll index 84a7d18ed15068..cc1c87b1fe377f 100644 --- a/llvm/test/CodeGen/RISCV/fixups- diff .ll +++ b/llvm/test/CodeGen/RISCV/fixups- diff .ll @@ -27,7 +27,7 @@ entry: ; CHECK: } ; CHECK: Section {{.*}} .rela.eh_frame { -; CHECK-NEXT: 0x1C R_RISCV_32_PCREL .L0 0x0 +; CHECK-NEXT: 0x1C R_RISCV_32_PCREL 0x0 ; CHECK-NEXT: } !llvm.dbg.cu = !{!0} diff --git a/llvm/test/DebugInfo/LoongArch/dwarf-loongarch-relocs.ll b/llvm/test/DebugInfo/LoongArch/dwarf-loongarch-relocs.ll index d28836d560377e..d6a1d8d6e1366f 100644 --- a/llvm/test/DebugInfo/LoongArch/dwarf-loongarch-relocs.ll +++ b/llvm/test/DebugInfo/LoongArch/dwarf-loongarch-relocs.ll @@ -18,21 +18,21 @@ ; RELOCS-BOTH: Section ({{.*}}) .rela.debug_frame { ; RELOCS-NORL-NEXT: 0x1C R_LARCH_32 .debug_frame 0x0 ; RELOCS-NORL-NEXT: 0x20 R_LARCH_64 .text 0x0 -; RELOCS-ENRL-NEXT: 0x1C R_LARCH_32 .L0 0x0 -; RELOCS-ENRL-NEXT: 0x20 R_LARCH_64 .L0 0x0 -; RELOCS-ENRL-NEXT: 0x28 R_LARCH_ADD64 .L0 0x0 -; RELOCS-ENRL-NEXT: 0x28 R_LARCH_SUB64 .L0 0x0 -; RELOCS-ENRL-NEXT: 0x3F R_LARCH_ADD6 .L0 0x0 -; RELOCS-ENRL-NEXT: 0x3F R_LARCH_SUB6 .L0 0x0 +; RELOCS-ENRL-NEXT: 0x1C R_LARCH_32 0x0 +; RELOCS-ENRL-NEXT: 0x20 R_LARCH_64 0x0 +; RELOCS-ENRL-NEXT: 0x28 R_LAR
[llvm-branch-commits] [clang] [CIR][NFC] Add scaffolding for the CIR dialect and CIROps.td (PR #86080)
https://github.com/lanza updated https://github.com/llvm/llvm-project/pull/86080 >From 435869501bb0788d8b22d847c3a870dbfbf94126 Mon Sep 17 00:00:00 2001 From: Nathan Lanza Date: Thu, 21 Mar 2024 04:57:16 + Subject: [PATCH 1/4] fix MLIRCIROpsIncGen Created using spr 1.3.5 --- .../clang/CIR/Dialect/IR/CIRDialect.td| 46 +++ clang/include/clang/CIR/Dialect/IR/CIROps.td | 18 2 files changed, 64 insertions(+) create mode 100644 clang/include/clang/CIR/Dialect/IR/CIRDialect.td diff --git a/clang/include/clang/CIR/Dialect/IR/CIRDialect.td b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td new file mode 100644 index 00..8f756fa422e5f3 --- /dev/null +++ b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td @@ -0,0 +1,46 @@ +//===- CIRTypes.td - CIR dialect types -*- tablegen -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// This file declares the CIR dialect. +// +//===--===// + +#ifndef MLIR_CIR_DIALECT_CIR +#define MLIR_CIR_DIALECT_CIR + +include "mlir/IR/OpBase.td" + +def CIR_Dialect : Dialect { + let name = "cir"; + + // A short one-line summary of our dialect. + let summary = "A high-level dialect for analyzing and optimizing Clang " +"supported languages"; + + let cppNamespace = "::mlir::cir"; + + let useDefaultAttributePrinterParser = 0; + let useDefaultTypePrinterParser = 0; + + let extraClassDeclaration = [{ +void registerAttributes(); +void registerTypes(); + +::mlir::Type parseType(::mlir::DialectAsmParser &parser) const override; +void printType(::mlir::Type type, + ::mlir::DialectAsmPrinter &printer) const override; + +::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const override; + +void printAttribute(::mlir::Attribute attr, +::mlir::DialectAsmPrinter &os) const override; + }]; +} + +#endif // MLIR_CIR_DIALECT_CIR diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td index e69de29bb2d1d6..cfc62986b0b9d1 100644 --- a/clang/include/clang/CIR/Dialect/IR/CIROps.td +++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td @@ -0,0 +1,18 @@ +//===-- CIROps.td - CIR dialect definition -*- tablegen -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +/// +/// \file +/// Definition of the CIR dialect +/// +//===--===// + +#ifndef MLIR_CIR_DIALECT_CIR_OPS +#define MLIR_CIR_DIALECT_CIR_OPS + +include "clang/CIR/Dialect/IR/CIRDialect.td" +#endif // MLIR_CIR_DIALECT_CIR_OPS >From fe44284534be0752d95634251289a5c74c06afe7 Mon Sep 17 00:00:00 2001 From: Nathan Lanza Date: Thu, 21 Mar 2024 05:12:26 + Subject: [PATCH 2/4] add some guts to CIRDialect.cpp and MLIRCIR lib Created using spr 1.3.5 --- clang/lib/CIR/Dialect/IR/CIRDialect.cpp | 11 +++ clang/lib/CIR/Dialect/IR/CMakeLists.txt | 3 +++ 2 files changed, 14 insertions(+) diff --git a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp index e69de29bb2d1d6..8abf39119e04f7 100644 --- a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp +++ b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp @@ -0,0 +1,11 @@ +//===- CIRDialect.cpp - MLIR CIR ops implementation ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// This file implements the CIR dialect and its operations. +// +//===--===// diff --git a/clang/lib/CIR/Dialect/IR/CMakeLists.txt b/clang/lib/CIR/Dialect/IR/CMakeLists.txt index e69de29bb2d1d6..0d7476b555705d 100644 --- a/clang/lib/CIR/Dialect/IR/CMakeLists.txt +++ b/clang/lib/CIR/Dialect/IR/CMakeLists.txt @@ -0,0 +1,3 @@ +add_clang_library(MLIRCIR + CIRDialect.cpp + ) >From 0e195548f24fb3748e22141739f914676b1d56d5 Mon Sep 17 00:00:00 2001 From: Nathan Lanza Date: Wed, 17 Apr 2024 18:59:53 + Subject: [PATCH 3/4] include dialect and add include guards Created using spr 1.3.5 --- clang/include/clang/CIR/Dialect/IR/CIRDialect.h | 5 + clang/l
[llvm-branch-commits] [clang] [CIR][NFC] Add scaffolding for the CIR dialect and CIROps.td (PR #86080)
https://github.com/lanza updated https://github.com/llvm/llvm-project/pull/86080 >From 435869501bb0788d8b22d847c3a870dbfbf94126 Mon Sep 17 00:00:00 2001 From: Nathan Lanza Date: Thu, 21 Mar 2024 04:57:16 + Subject: [PATCH 1/4] fix MLIRCIROpsIncGen Created using spr 1.3.5 --- .../clang/CIR/Dialect/IR/CIRDialect.td| 46 +++ clang/include/clang/CIR/Dialect/IR/CIROps.td | 18 2 files changed, 64 insertions(+) create mode 100644 clang/include/clang/CIR/Dialect/IR/CIRDialect.td diff --git a/clang/include/clang/CIR/Dialect/IR/CIRDialect.td b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td new file mode 100644 index 00..8f756fa422e5f3 --- /dev/null +++ b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td @@ -0,0 +1,46 @@ +//===- CIRTypes.td - CIR dialect types -*- tablegen -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// This file declares the CIR dialect. +// +//===--===// + +#ifndef MLIR_CIR_DIALECT_CIR +#define MLIR_CIR_DIALECT_CIR + +include "mlir/IR/OpBase.td" + +def CIR_Dialect : Dialect { + let name = "cir"; + + // A short one-line summary of our dialect. + let summary = "A high-level dialect for analyzing and optimizing Clang " +"supported languages"; + + let cppNamespace = "::mlir::cir"; + + let useDefaultAttributePrinterParser = 0; + let useDefaultTypePrinterParser = 0; + + let extraClassDeclaration = [{ +void registerAttributes(); +void registerTypes(); + +::mlir::Type parseType(::mlir::DialectAsmParser &parser) const override; +void printType(::mlir::Type type, + ::mlir::DialectAsmPrinter &printer) const override; + +::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const override; + +void printAttribute(::mlir::Attribute attr, +::mlir::DialectAsmPrinter &os) const override; + }]; +} + +#endif // MLIR_CIR_DIALECT_CIR diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td index e69de29bb2d1d6..cfc62986b0b9d1 100644 --- a/clang/include/clang/CIR/Dialect/IR/CIROps.td +++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td @@ -0,0 +1,18 @@ +//===-- CIROps.td - CIR dialect definition -*- tablegen -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +/// +/// \file +/// Definition of the CIR dialect +/// +//===--===// + +#ifndef MLIR_CIR_DIALECT_CIR_OPS +#define MLIR_CIR_DIALECT_CIR_OPS + +include "clang/CIR/Dialect/IR/CIRDialect.td" +#endif // MLIR_CIR_DIALECT_CIR_OPS >From fe44284534be0752d95634251289a5c74c06afe7 Mon Sep 17 00:00:00 2001 From: Nathan Lanza Date: Thu, 21 Mar 2024 05:12:26 + Subject: [PATCH 2/4] add some guts to CIRDialect.cpp and MLIRCIR lib Created using spr 1.3.5 --- clang/lib/CIR/Dialect/IR/CIRDialect.cpp | 11 +++ clang/lib/CIR/Dialect/IR/CMakeLists.txt | 3 +++ 2 files changed, 14 insertions(+) diff --git a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp index e69de29bb2d1d6..8abf39119e04f7 100644 --- a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp +++ b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp @@ -0,0 +1,11 @@ +//===- CIRDialect.cpp - MLIR CIR ops implementation ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// This file implements the CIR dialect and its operations. +// +//===--===// diff --git a/clang/lib/CIR/Dialect/IR/CMakeLists.txt b/clang/lib/CIR/Dialect/IR/CMakeLists.txt index e69de29bb2d1d6..0d7476b555705d 100644 --- a/clang/lib/CIR/Dialect/IR/CMakeLists.txt +++ b/clang/lib/CIR/Dialect/IR/CMakeLists.txt @@ -0,0 +1,3 @@ +add_clang_library(MLIRCIR + CIRDialect.cpp + ) >From 0e195548f24fb3748e22141739f914676b1d56d5 Mon Sep 17 00:00:00 2001 From: Nathan Lanza Date: Wed, 17 Apr 2024 18:59:53 + Subject: [PATCH 3/4] include dialect and add include guards Created using spr 1.3.5 --- clang/include/clang/CIR/Dialect/IR/CIRDialect.h | 5 + clang/l
[llvm-branch-commits] [clang] [CIR] Add options to emit ClangIR and enable the ClangIR pipeline (PR #89030)
@@ -2876,6 +2876,15 @@ def flax_vector_conversions : Flag<["-"], "flax-vector-conversions">, Group, Group, HelpText<"Force linking the clang builtins runtime library">; + +/// ClangIR-specific options - BEGIN +def fclangir_enable : Flag<["-"], "fclangir-enable">, Visibility<[ClangOption, CC1Option]>, + Group, HelpText<"Use ClangIR pipeline to compile">, + MarshallingInfoFlag>; +def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>, lanza wrote: > Should this be a cc1-only option, same as -emit-obj and -emit-llvm-bc? (It's > always struck me as odd that -emit-llvm is not a cc1-only option...) I prefer it being a driver flag as well if there's no strong protest. https://github.com/llvm/llvm-project/pull/89030 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [CIR] Add options to emit ClangIR and enable the ClangIR pipeline (PR #89030)
@@ -408,6 +411,9 @@ class FrontendOptions { LLVM_PREFERRED_TYPE(bool) unsigned GenReducedBMI : 1; + /// Use Clang IR pipeline to emit code + unsigned UseClangIRPipeline : 1; lanza wrote: Ah I guess this is why we didn't have the `false` defualt before. This was added a few months ago @bcardosolopes https://github.com/llvm/llvm-project/pull/89030 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [CIR] Add options to emit ClangIR and enable the ClangIR pipeline (PR #89030)
https://github.com/lanza updated https://github.com/llvm/llvm-project/pull/89030 >From 21d80d2c5e2d67d54bfb450eb53b1fa73ffb635a Mon Sep 17 00:00:00 2001 From: Nathan Lanza Date: Wed, 17 Apr 2024 07:26:49 + Subject: [PATCH] fix options.td Created using spr 1.3.5 --- clang/include/clang/Driver/Options.td | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 659650baf218f8..3c64ad45c1f86a 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -2876,18 +2876,21 @@ def flax_vector_conversions : Flag<["-"], "flax-vector-conversions">, Group, Group, HelpText<"Force linking the clang builtins runtime library">; -def flto_EQ : Joined<["-"], "flto=">, - Visibility<[ClangOption, CLOption, CC1Option, FC1Option, FlangOption]>, - Group, - HelpText<"Set LTO mode">, Values<"thin,full">; -def flto_EQ_jobserver : Flag<["-"], "flto=jobserver">, Visibility<[ClangOption, FlangOption]>, Group, - Alias, AliasArgs<["full"]>, HelpText<"Enable LTO in 'full' mode">; + /// ClangIR-specific options - BEGIN def fclangir_enable : Flag<["-"], "fclangir-enable">, Visibility<[ClangOption, CC1Option]>, Group, HelpText<"Use ClangIR pipeline to compile">, MarshallingInfoFlag>; def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>, Group, HelpText<"Build ASTs and then lower to ClangIR, emit the .cir file">; +/// ClangIR-specific options - END + +def flto_EQ : Joined<["-"], "flto=">, + Visibility<[ClangOption, CLOption, CC1Option, FC1Option, FlangOption]>, + Group, + HelpText<"Set LTO mode">, Values<"thin,full">; +def flto_EQ_jobserver : Flag<["-"], "flto=jobserver">, Visibility<[ClangOption, FlangOption]>, Group, + Alias, AliasArgs<["full"]>, HelpText<"Enable LTO in 'full' mode">; def flto_EQ_auto : Flag<["-"], "flto=auto">, Visibility<[ClangOption, FlangOption]>, Group, Alias, AliasArgs<["full"]>, HelpText<"Enable LTO in 'full' mode">; def flto : Flag<["-"], "flto">, ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [CIR] Add options to emit ClangIR and enable the ClangIR pipeline (PR #89030)
https://github.com/lanza updated https://github.com/llvm/llvm-project/pull/89030 >From 21d80d2c5e2d67d54bfb450eb53b1fa73ffb635a Mon Sep 17 00:00:00 2001 From: Nathan Lanza Date: Wed, 17 Apr 2024 07:26:49 + Subject: [PATCH] fix options.td Created using spr 1.3.5 --- clang/include/clang/Driver/Options.td | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 659650baf218f8..3c64ad45c1f86a 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -2876,18 +2876,21 @@ def flax_vector_conversions : Flag<["-"], "flax-vector-conversions">, Group, Group, HelpText<"Force linking the clang builtins runtime library">; -def flto_EQ : Joined<["-"], "flto=">, - Visibility<[ClangOption, CLOption, CC1Option, FC1Option, FlangOption]>, - Group, - HelpText<"Set LTO mode">, Values<"thin,full">; -def flto_EQ_jobserver : Flag<["-"], "flto=jobserver">, Visibility<[ClangOption, FlangOption]>, Group, - Alias, AliasArgs<["full"]>, HelpText<"Enable LTO in 'full' mode">; + /// ClangIR-specific options - BEGIN def fclangir_enable : Flag<["-"], "fclangir-enable">, Visibility<[ClangOption, CC1Option]>, Group, HelpText<"Use ClangIR pipeline to compile">, MarshallingInfoFlag>; def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>, Group, HelpText<"Build ASTs and then lower to ClangIR, emit the .cir file">; +/// ClangIR-specific options - END + +def flto_EQ : Joined<["-"], "flto=">, + Visibility<[ClangOption, CLOption, CC1Option, FC1Option, FlangOption]>, + Group, + HelpText<"Set LTO mode">, Values<"thin,full">; +def flto_EQ_jobserver : Flag<["-"], "flto=jobserver">, Visibility<[ClangOption, FlangOption]>, Group, + Alias, AliasArgs<["full"]>, HelpText<"Enable LTO in 'full' mode">; def flto_EQ_auto : Flag<["-"], "flto=auto">, Visibility<[ClangOption, FlangOption]>, Group, Alias, AliasArgs<["full"]>, HelpText<"Enable LTO in 'full' mode">; def flto : Flag<["-"], "flto">, ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] release/18.x: [Clang] Handle structs with inner structs and no fields (#89126) (PR #89456)
tstellar wrote: @bwendling It looks like the test added in this PR is failing on the release branch. https://github.com/llvm/llvm-project/pull/89456 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [polly] release/18.x: [clang-format] Revert breaking stream operators to prev… (PR #89492)
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/89492 >From c0b48372d82aa0adaef671788ee1a37a650ee4fd Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 19 Apr 2024 23:58:35 -0700 Subject: [PATCH] release/18.x: [clang-format] Revert breaking stream operators to previous default (#89016) Backport 29ecd6d50f14 --- clang/lib/Format/TokenAnnotator.cpp | 8 ++-- clang/unittests/Format/FormatTest.cpp | 7 +-- clang/unittests/Format/TokenAnnotatorTest.cpp | 9 - polly/lib/Analysis/DependenceInfo.cpp | 4 ++-- polly/lib/Analysis/ScopBuilder.cpp| 7 --- 5 files changed, 9 insertions(+), 26 deletions(-) diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 4d482e6543d6f5..9c4a8381f99824 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -5157,12 +5157,8 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line, return true; if (Left.IsUnterminatedLiteral) return true; - // FIXME: Breaking after newlines seems useful in general. Turn this into an - // option and recognize more cases like endl etc, and break independent of - // what comes after operator lessless. - if (Right.is(tok::lessless) && Right.Next && - Right.Next->is(tok::string_literal) && Left.is(tok::string_literal) && - Left.TokenText.ends_with("\\n\"")) { + if (Right.is(tok::lessless) && Right.Next && Left.is(tok::string_literal) && + Right.Next->is(tok::string_literal)) { return true; } if (Right.is(TT_RequiresClause)) { diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 6b4f9075d8f0ab..2ac0b0aab1bee9 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -27031,12 +27031,6 @@ TEST_F(FormatTest, PPDirectivesAndCommentsInBracedInit) { getLLVMStyleWithColumns(30)); } -TEST_F(FormatTest, StreamOutputOperator) { - verifyFormat("std::cout << \"foo\" << \"bar\" << baz;"); - verifyFormat("std::cout << \"foo\\n\"\n" - " << \"bar\";"); -} - TEST_F(FormatTest, BreakAdjacentStringLiterals) { constexpr StringRef Code{ "return \"Code\" \"\\0\\52\\26\\55\\55\\0\" \"x013\" \"\\02\\xBA\";"}; @@ -27051,6 +27045,7 @@ TEST_F(FormatTest, BreakAdjacentStringLiterals) { Style.BreakAdjacentStringLiterals = false; verifyFormat(Code, Style); } + } // namespace } // namespace test } // namespace format diff --git a/clang/unittests/Format/TokenAnnotatorTest.cpp b/clang/unittests/Format/TokenAnnotatorTest.cpp index f767b83a875471..cbe6b79a366882 100644 --- a/clang/unittests/Format/TokenAnnotatorTest.cpp +++ b/clang/unittests/Format/TokenAnnotatorTest.cpp @@ -2624,15 +2624,6 @@ TEST_F(TokenAnnotatorTest, BraceKind) { EXPECT_BRACE_KIND(Tokens[21], BK_BracedInit); } -TEST_F(TokenAnnotatorTest, StreamOperator) { - auto Tokens = annotate("\"foo\\n\" << aux << \"foo\\n\" << \"foo\";"); - ASSERT_EQ(Tokens.size(), 9u) << Tokens; - EXPECT_FALSE(Tokens[1]->MustBreakBefore); - EXPECT_FALSE(Tokens[3]->MustBreakBefore); - // Only break between string literals if the former ends with \n. - EXPECT_TRUE(Tokens[5]->MustBreakBefore); -} - } // namespace } // namespace format } // namespace clang diff --git a/polly/lib/Analysis/DependenceInfo.cpp b/polly/lib/Analysis/DependenceInfo.cpp index 69257c603877ea..d58dc9917bc91f 100644 --- a/polly/lib/Analysis/DependenceInfo.cpp +++ b/polly/lib/Analysis/DependenceInfo.cpp @@ -950,8 +950,8 @@ class DependenceInfoPrinterLegacyPass final : public ScopPass { bool runOnScop(Scop &S) override { DependenceInfo &P = getAnalysis(); -OS << "Printing analysis '" << P.getPassName() << "' for " << "region: '" - << S.getRegion().getNameStr() << "' in function '" +OS << "Printing analysis '" << P.getPassName() << "' for " + << "region: '" << S.getRegion().getNameStr() << "' in function '" << S.getFunction().getName() << "':\n"; P.printScop(OS, S); diff --git a/polly/lib/Analysis/ScopBuilder.cpp b/polly/lib/Analysis/ScopBuilder.cpp index c62cb2a85c835c..64314d6041b8e9 100644 --- a/polly/lib/Analysis/ScopBuilder.cpp +++ b/polly/lib/Analysis/ScopBuilder.cpp @@ -2689,9 +2689,10 @@ void ScopBuilder::addUserContext() { if (NameContext != NameUserContext) { std::string SpaceStr = stringFromIslObj(Space, "null"); errs() << "Error: the name of dimension " << i - << " provided in -polly-context " << "is '" << NameUserContext - << "', but the name in the computed " << "context is '" - << NameContext << "'. Due to this name mismatch, " + << " provided in -polly-context " + << "is '" << NameUserContext << "', but the name in the computed " + << "context is '" << NameContext + << "'. Due to this name mismatch, " << "the -polly-co
[llvm-branch-commits] [clang] [polly] release/18.x: [clang-format] Revert breaking stream operators to prev… (PR #89492)
owenca wrote: > @owenca Can you rebase this branch? @tstellar I've rebased it. https://github.com/llvm/llvm-project/pull/89492 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [flang][OpenMP] Support tasks' implicit firstprivate DSA (PR #85989)
@@ -2012,34 +2012,87 @@ void OmpAttributeVisitor::Post(const parser::Name &name) { } } } -std::vector defaultDSASymbols; + +// Implicitly determined DSAs +// OMP 5.2 5.1.1 - Variables Referenced in a Construct +Symbol *lastDeclSymbol = nullptr; +std::optional prevDSA; for (int dirDepth{0}; dirDepth < (int)dirContext_.size(); ++dirDepth) { DirContext &dirContext = dirContext_[dirDepth]; - bool hasDataSharingAttr{false}; + std::optional dsa; + for (auto symMap : dirContext.objectWithDSA) { // if the `symbol` already has a data-sharing attribute if (symMap.first->name() == name.symbol->name()) { - hasDataSharingAttr = true; + dsa = symMap.second; break; } } - if (hasDataSharingAttr) { -if (defaultDSASymbols.size()) - symbol = &MakeAssocSymbol(symbol->name(), *defaultDSASymbols.back(), + + // When handling each implicit rule, either a new private symbol is + // declared or the last declared symbol is used. + // In the latter case, it's necessary to insert a new symbol in the scope + // being processed, associated with the last declared symbol, to avoid + // "inheriting" the enclosing context's symbol and its flags. kiranchandramohan wrote: Thanks @luporl. It is very clear now. https://github.com/llvm/llvm-project/pull/85989 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits