Skip to content

Commit 6a02c0f

Browse files
[Flang]Fix propagation of loop collapse number for target-based directives (llvm#162707)
1 parent a19c9a8 commit 6a02c0f

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

flang/lib/Lower/OpenMP/OpenMP.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ class HostEvalInfo {
153153
clauseOps.loopLowerBounds = ops.loopLowerBounds;
154154
clauseOps.loopUpperBounds = ops.loopUpperBounds;
155155
clauseOps.loopSteps = ops.loopSteps;
156+
clauseOps.collapseNumLoops = ops.collapseNumLoops;
156157
ivOut.append(iv);
157158
return true;
158159
}

flang/test/Lower/OpenMP/distribute-parallel-do-simd.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ subroutine lastprivate_cond_in_composite_construct(x_min, x_max, y_min, y_max)
112112
! CHECK: omp.distribute {
113113
! CHECK: omp.wsloop {
114114
! CHECK: omp.simd private({{.*}}) {
115-
! CHECK: omp.loop_nest (%[[I_IV:.*]], %[[J_IV:.*]]) : i32 = ({{.*}}) to ({{.*}}) inclusive step ({{.*}}) {
115+
! CHECK: omp.loop_nest (%[[I_IV:.*]], %[[J_IV:.*]]) : i32 = ({{.*}}) to ({{.*}}) inclusive step ({{.*}}) collapse(2) {
116116
! CHECK: %[[Y_MAX_PRIV:.*]]:2 = hlfir.declare %{{.*}} {uniq_name = "{{.*}}y_max"}
117117

118118
! CHECK: %[[I_UB:.*]] = fir.load %[[X_MAX_MAPPED]]#0 : !fir.ref<i32>

0 commit comments

Comments
 (0)