Skip to content

Commit 4fb5d42

Browse files
committed
Review comments
1 parent ba6d59c commit 4fb5d42

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ static LogicalResult checkImplementationStatus(Operation &op) {
162162
omp::ClauseCancellationConstructType cancelledDirective =
163163
op.getCancelDirective();
164164
if (cancelledDirective != omp::ClauseCancellationConstructType::Parallel)
165-
result = todo("cancel directive");
165+
result = todo("cancel directive construct type not yet supported");
166166
};
167167
auto checkDepend = [&todo](auto op, LogicalResult &result) {
168168
if (!op.getDependVars().empty() || op.getDependKinds())
@@ -1591,15 +1591,13 @@ cleanupPrivateVars(llvm::IRBuilderBase &builder,
15911591
static bool constructIsCancellable(Operation *op) {
15921592
// omp.cancel must be "closely nested" so it will be visible and not inside of
15931593
// funcion calls. This is enforced by the verifier.
1594-
bool containsCancel = false;
1595-
op->walk([&containsCancel](Operation *child) {
1596-
if (mlir::isa<omp::CancelOp>(child)) {
1597-
containsCancel = true;
1598-
return WalkResult::interrupt();
1599-
}
1600-
return WalkResult::advance();
1601-
});
1602-
return containsCancel;
1594+
return op
1595+
->walk([](Operation *child) {
1596+
if (mlir::isa<omp::CancelOp>(child))
1597+
return WalkResult::interrupt();
1598+
return WalkResult::advance();
1599+
})
1600+
.wasInterrupted();
16031601
}
16041602

16051603
static LogicalResult

mlir/test/Target/LLVMIR/openmp-todo.mlir

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ llvm.func @cancel_wsloop(%lb : i32, %ub : i32, %step: i32) {
3131
omp.wsloop {
3232
// expected-error@below {{LLVM Translation failed for operation: omp.loop_nest}}
3333
omp.loop_nest (%iv) : i32 = (%lb) to (%ub) step (%step) {
34-
// expected-error@below {{not yet implemented: Unhandled clause cancel directive in omp.cancel operation}}
34+
// expected-error@below {{not yet implemented: Unhandled clause cancel directive construct type not yet supported in omp.cancel operation}}
3535
// expected-error@below {{LLVM Translation failed for operation: omp.cancel}}
3636
omp.cancel cancellation_construct_type(loop)
3737
omp.yield
@@ -46,7 +46,7 @@ llvm.func @cancel_sections() {
4646
// expected-error@below {{LLVM Translation failed for operation: omp.sections}}
4747
omp.sections {
4848
omp.section {
49-
// expected-error@below {{not yet implemented: Unhandled clause cancel directive in omp.cancel operation}}
49+
// expected-error@below {{not yet implemented: Unhandled clause cancel directive construct type not yet supported in omp.cancel operation}}
5050
// expected-error@below {{LLVM Translation failed for operation: omp.cancel}}
5151
omp.cancel cancellation_construct_type(sections)
5252
omp.terminator
@@ -63,7 +63,7 @@ llvm.func @cancel_taskgroup() {
6363
omp.taskgroup {
6464
// expected-error@below {{LLVM Translation failed for operation: omp.task}}
6565
omp.task {
66-
// expected-error@below {{not yet implemented: Unhandled clause cancel directive in omp.cancel operation}}
66+
// expected-error@below {{not yet implemented: Unhandled clause cancel directive construct type not yet supported in omp.cancel operation}}
6767
// expected-error@below {{LLVM Translation failed for operation: omp.cancel}}
6868
omp.cancel cancellation_construct_type(taskgroup)
6969
omp.terminator

0 commit comments

Comments
 (0)