[flang-commits] [flang] 6a02c0f - [Flang]Fix propagation of loop collapse number for target-based directives (#162707)
via flang-commits
flang-commits at lists.llvm.org
Thu Oct 9 11:32:13 PDT 2025
Author: Alexey Bataev
Date: 2025-10-09T14:32:10-04:00
New Revision: 6a02c0f2fa696b226e9d3c5250802cc045985876
URL: https://github.com/llvm/llvm-project/commit/6a02c0f2fa696b226e9d3c5250802cc045985876
DIFF: https://github.com/llvm/llvm-project/commit/6a02c0f2fa696b226e9d3c5250802cc045985876.diff
LOG: [Flang]Fix propagation of loop collapse number for target-based directives (#162707)
Added:
Modified:
flang/lib/Lower/OpenMP/OpenMP.cpp
flang/test/Lower/OpenMP/distribute-parallel-do-simd.f90
Removed:
################################################################################
diff --git a/flang/lib/Lower/OpenMP/OpenMP.cpp b/flang/lib/Lower/OpenMP/OpenMP.cpp
index 9e56c2bfb7e25..bd94651919960 100644
--- a/flang/lib/Lower/OpenMP/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP/OpenMP.cpp
@@ -153,6 +153,7 @@ class HostEvalInfo {
clauseOps.loopLowerBounds = ops.loopLowerBounds;
clauseOps.loopUpperBounds = ops.loopUpperBounds;
clauseOps.loopSteps = ops.loopSteps;
+ clauseOps.collapseNumLoops = ops.collapseNumLoops;
ivOut.append(iv);
return true;
}
diff --git a/flang/test/Lower/OpenMP/distribute-parallel-do-simd.f90 b/flang/test/Lower/OpenMP/distribute-parallel-do-simd.f90
index 142bc02ae8c1d..c769152318663 100644
--- a/flang/test/Lower/OpenMP/distribute-parallel-do-simd.f90
+++ b/flang/test/Lower/OpenMP/distribute-parallel-do-simd.f90
@@ -112,7 +112,7 @@ subroutine lastprivate_cond_in_composite_construct(x_min, x_max, y_min, y_max)
! CHECK: omp.distribute {
! CHECK: omp.wsloop {
! CHECK: omp.simd private({{.*}}) {
-! CHECK: omp.loop_nest (%[[I_IV:.*]], %[[J_IV:.*]]) : i32 = ({{.*}}) to ({{.*}}) inclusive step ({{.*}}) {
+! CHECK: omp.loop_nest (%[[I_IV:.*]], %[[J_IV:.*]]) : i32 = ({{.*}}) to ({{.*}}) inclusive step ({{.*}}) collapse(2) {
! CHECK: %[[Y_MAX_PRIV:.*]]:2 = hlfir.declare %{{.*}} {uniq_name = "{{.*}}y_max"}
! CHECK: %[[I_UB:.*]] = fir.load %[[X_MAX_MAPPED]]#0 : !fir.ref<i32>
More information about the flang-commits
mailing list