File tree 2 files changed +23
-2
lines changed 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -398,8 +398,8 @@ class ReductionsHoistingPattern
398
398
399
399
static mlir::omp::LoopOp
400
400
tryToFindNestedLoopWithReduction (mlir::omp::TeamsOp teamsOp) {
401
- assert (! teamsOp.getRegion ().empty () &&
402
- teamsOp. getRegion (). getBlocks (). size () == 1 ) ;
401
+ if ( teamsOp.getRegion ().getBlocks (). size () != 1 )
402
+ return nullptr ;
403
403
404
404
mlir::Block &teamsBlock = *teamsOp.getRegion ().begin ();
405
405
auto loopOpIter = llvm::find_if (teamsBlock, [](mlir::Operation &op) {
Original file line number Diff line number Diff line change @@ -337,3 +337,24 @@ subroutine loop_teams_loop_reduction
337
337
x = x + i
338
338
end do
339
339
end subroutine
340
+
341
+
342
+ ! Tests a regression when the pass encounters a multi-block `teams` region.
343
+ subroutine multi_block_teams
344
+ implicit none
345
+ integer :: i
346
+
347
+ ! CHECK: omp.target {{.*}} {
348
+ ! CHECK: omp.teams {
349
+ ! CHECK: ^bb1:
350
+ ! CHECK: cf.br ^bb2
351
+ ! CHECK: ^bb2:
352
+ ! CHECK: omp.terminator
353
+ ! CHECK: }
354
+ ! CHECK: }
355
+ ! $omp target teams
356
+ select case (i)
357
+ case (1 )
358
+ end select
359
+ ! $omp end target teams
360
+ end subroutine
You can’t perform that action at this time.
0 commit comments