Skip to content

Commit b11ddd7

Browse files
committed
Fix tests
1 parent 8d0651f commit b11ddd7

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

flang/lib/Optimizer/OpenMP/LowerWorkshare.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,12 @@ static void parallelizeRegion(Region &sourceRegion, Region &targetRegion,
249249
if (isSafeToParallelize(&op)) {
250250
singleBuilder.clone(op, singleMapping);
251251
if (llvm::all_of(op.getOperands(), [&](Value opr) {
252-
return rootMapping.contains(opr);
252+
// Either we have already remapped it
253+
bool remapped = rootMapping.contains(opr);
254+
// Or it is available because it dominates `sr`
255+
bool dominates =
256+
di.properlyDominates(opr.getDefiningOp(), &*sr.begin);
257+
return remapped || dominates;
253258
})) {
254259
// Safe to parallelize operations which have all operands available in
255260
// the root parallel block can be executed there.

flang/test/Transforms/OpenMP/lower-workshare-correct-parallelize.mlir

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,12 @@ func.func @foo() {
1414
}
1515
return
1616
}
17+
18+
// CHECK: omp.single nowait
19+
// CHECK: fir.allocmem
20+
// CHECK: fir.shape
21+
// CHECK: fir.declare
22+
// CHECK: fir.freemem
23+
// CHECK: omp.terminator
24+
// CHECK: }
25+
// CHECK: omp.barrier

flang/test/Transforms/OpenMP/lower-workshare-todo-cfg-dom.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: fir-opt --lower-workshare --allow-unregistered-dialect %s 2>&1 | FileCheck %s
22

3-
// CHECK: warning: omp workshare with unstructured control flow currently unsupported and will be serialized.
3+
// CHECK: warning: omp workshare with unstructured control flow is currently unsupported and will be serialized.
44

55
// CHECK: omp.parallel
66
// CHECK-NEXT: omp.single

flang/test/Transforms/OpenMP/lower-workshare-todo-cfg.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: fir-opt --lower-workshare --allow-unregistered-dialect %s 2>&1 | FileCheck %s
22

3-
// CHECK: warning: omp workshare with unstructured control flow currently unsupported and will be serialized.
3+
// CHECK: warning: omp workshare with unstructured control flow is currently unsupported and will be serialized.
44

55
// CHECK: omp.parallel
66
// CHECK-NEXT: omp.single

0 commit comments

Comments
 (0)