File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -398,8 +398,8 @@ class ReductionsHoistingPattern
398398
399399 static mlir::omp::LoopOp
400400 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 ;
403403
404404 mlir::Block &teamsBlock = *teamsOp.getRegion ().begin ();
405405 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
337337 x = x + i
338338 end do
339339end 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