Index: mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td =================================================================== --- mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td +++ mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td @@ -412,6 +412,9 @@ The body region can contain any number of blocks. The region is terminated by "omp.yield" instruction without operands. + Collapsed loops are represented by the simd-loop having a list of indices, + bounds and steps where the size of the list is equal to the collapse value. + When an if clause is present and evaluates to false, the preferred number of iterations to be executed concurrently is one, regardless of whether a simdlen clause is speciļ¬ed. Index: mlir/test/Target/LLVMIR/openmp-llvm.mlir =================================================================== --- mlir/test/Target/LLVMIR/openmp-llvm.mlir +++ mlir/test/Target/LLVMIR/openmp-llvm.mlir @@ -712,7 +712,14 @@ omp.simdloop for (%iv1, %iv2) : i64 = (%lb1, %lb2) to (%ub1, %ub2) step (%step1, %step2) { %3 = llvm.mlir.constant(2.000000e+00 : f32) : f32 // The form of the emitted IR is controlled by OpenMPIRBuilder and - // tested there. Just check that the right metadata is added. + // tested there. Just check that the right metadata is added and collapsed + // blocks are generated (Collapse clause is represented as a loop with + // list of indices, bounds and steps where the size of the list is equal + // to the collapse value.) + // CHECK: omp_collapsed.preheader + // CHECK: omp_collapsed.header + // CHECK: omp_collapsed.cond + // CHECK: omp_collapsed.body // CHECK: llvm.access.group // CHECK-NEXT: llvm.access.group %4 = llvm.getelementptr %arg0[%iv1] : (!llvm.ptr, i64) -> !llvm.ptr