Skip to content

Commit d28a782

Browse files
authored
[flang][openacc] Use bounds information in reduction recipe combiner (llvm#67719)
This patch makes use of the bounds in the combiner region for known shape arrays. Until know the combiner region was iterating over the whole array. Lowerbound, upperbound and step are passed as block arguments after the two values. A follow up patch will make use of this information for the assumed shape arrays as well.
1 parent 54ddd07 commit d28a782

File tree

2 files changed

+42
-66
lines changed

2 files changed

+42
-66
lines changed

flang/lib/Lower/OpenACC.cpp

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -865,21 +865,24 @@ static mlir::Value genScalarCombiner(fir::FirOpBuilder &builder,
865865

866866
static void genCombiner(fir::FirOpBuilder &builder, mlir::Location loc,
867867
mlir::acc::ReductionOperator op, mlir::Type ty,
868-
mlir::Value value1, mlir::Value value2) {
868+
mlir::Value value1, mlir::Value value2,
869+
mlir::acc::ReductionRecipeOp &recipe) {
869870
ty = fir::unwrapRefType(ty);
870871

871872
if (auto seqTy = mlir::dyn_cast<fir::SequenceType>(ty)) {
872873
assert(!seqTy.hasDynamicExtents() &&
873874
"Assumed shaped array should be boxed for reduction");
874-
mlir::Type idxTy = builder.getIndexType();
875875
mlir::Type refTy = fir::ReferenceType::get(seqTy.getEleTy());
876-
876+
unsigned nbRangeArgs = recipe.getCombinerRegion().getArguments().size() - 2;
877+
assert((nbRangeArgs / 3 == seqTy.getDimension()) &&
878+
"Expect 3 block arguments per dimension");
877879
llvm::SmallVector<fir::DoLoopOp> loops;
878880
llvm::SmallVector<mlir::Value> ivs;
879-
for (auto ext : llvm::reverse(seqTy.getShape())) {
880-
auto lb = builder.createIntegerConstant(loc, idxTy, 0);
881-
auto ub = builder.createIntegerConstant(loc, idxTy, ext - 1);
882-
auto step = builder.createIntegerConstant(loc, idxTy, 1);
881+
for (unsigned i = 2; i < recipe.getCombinerRegion().getArguments().size();
882+
i += 3) {
883+
mlir::Value lb = recipe.getCombinerRegion().getArgument(i);
884+
mlir::Value ub = recipe.getCombinerRegion().getArgument(i + 1);
885+
mlir::Value step = recipe.getCombinerRegion().getArgument(i + 2);
883886
auto loop = builder.create<fir::DoLoopOp>(loc, lb, ub, step,
884887
/*unordered=*/false);
885888
builder.setInsertionPointToStart(loop.getBody());
@@ -942,12 +945,27 @@ mlir::acc::ReductionRecipeOp Fortran::lower::createOrGetReductionRecipe(
942945
mlir::Value initValue = genReductionInitRegion(builder, loc, ty, op);
943946
builder.create<mlir::acc::YieldOp>(loc, initValue);
944947

948+
// The two first block arguments are the two values to be combined.
949+
// The next arguments are the iteration ranges (lb, ub, step) to be used
950+
// for the combiner if needed.
951+
llvm::SmallVector<mlir::Type> argsTy{ty, ty};
952+
llvm::SmallVector<mlir::Location> argsLoc{loc, loc};
953+
for (mlir::Value bound : llvm::reverse(bounds)) {
954+
auto dataBound =
955+
mlir::dyn_cast<mlir::acc::DataBoundsOp>(bound.getDefiningOp());
956+
argsTy.push_back(dataBound.getLowerbound().getType());
957+
argsLoc.push_back(dataBound.getLowerbound().getLoc());
958+
argsTy.push_back(dataBound.getUpperbound().getType());
959+
argsLoc.push_back(dataBound.getUpperbound().getLoc());
960+
argsTy.push_back(dataBound.getStartIdx().getType());
961+
argsLoc.push_back(dataBound.getStartIdx().getLoc());
962+
}
945963
builder.createBlock(&recipe.getCombinerRegion(),
946-
recipe.getCombinerRegion().end(), {ty, ty}, {loc, loc});
964+
recipe.getCombinerRegion().end(), argsTy, argsLoc);
947965
builder.setInsertionPointToEnd(&recipe.getCombinerRegion().back());
948966
mlir::Value v1 = recipe.getCombinerRegion().front().getArgument(0);
949967
mlir::Value v2 = recipe.getCombinerRegion().front().getArgument(1);
950-
genCombiner(builder, loc, op, ty, v1, v2);
968+
genCombiner(builder, loc, op, ty, v1, v2, recipe);
951969
builder.create<mlir::acc::YieldOp>(loc, v1);
952970
builder.restoreInsertionPoint(crtPos);
953971
return recipe;

flang/test/Lower/OpenACC/acc-reduction.f90

Lines changed: 15 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
! HLFIR: hlfir.assign %[[INIT_VALUE]] to %[[DECLARE]]#0 : f32, !fir.box<!fir.array<?xf32>>
1515
! HLFIR: acc.yield %[[DECLARE]]#0 : !fir.box<!fir.array<?xf32>>
1616
! CHECK: } combiner {
17-
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.box<!fir.array<?xf32>>, %[[ARG1:.*]]: !fir.box<!fir.array<?xf32>>):
17+
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.box<!fir.array<?xf32>>, %[[ARG1:.*]]: !fir.box<!fir.array<?xf32>>
1818
! HLFIR: %[[BOX_DIMS:.*]]:3 = fir.box_dims %[[ARG0]], %{{.*}} : (!fir.box<!fir.array<?xf32>>, index) -> (index, index, index)
1919
! HLFIR: %[[SHAPE:.*]] = fir.shape %[[BOX_DIMS]]#1 : (index) -> !fir.shape<1>
2020
! HLFIR: %[[ELEMENTAL:.*]] = hlfir.elemental %[[SHAPE]] unordered : (!fir.shape<1>) -> !hlfir.expr<?xf32> {
21-
! HLFIR: ^bb0(%arg2: index):
21+
! HLFIR: ^bb0(%{{.*}}: index):
2222
! HLFIR: %[[DES_V1:.*]] = hlfir.designate %[[ARG0]] (%{{.*}}) : (!fir.box<!fir.array<?xf32>>, index) -> !fir.ref<f32>
2323
! HLFIR: %[[DES_V2:.*]] = hlfir.designate %[[ARG1]] (%{{.*}}) : (!fir.box<!fir.array<?xf32>>, index) -> !fir.ref<f32>
2424
! HLFIR: %[[LOAD_V1:.*]] = fir.load %[[DES_V1]] : !fir.ref<f32>
@@ -42,7 +42,7 @@
4242
! HLFIR: hlfir.assign %[[INIT_VALUE]] to %[[DECLARE]]#0 : i32, !fir.box<!fir.array<?xi32>>
4343
! HLFIR: acc.yield %[[DECLARE]]#0 : !fir.box<!fir.array<?xi32>>
4444
! CHECK: } combiner {
45-
! CHECK: ^bb0(%[[V1:.*]]: !fir.box<!fir.array<?xi32>>, %[[V2:.*]]: !fir.box<!fir.array<?xi32>>):
45+
! CHECK: ^bb0(%[[V1:.*]]: !fir.box<!fir.array<?xi32>>, %[[V2:.*]]: !fir.box<!fir.array<?xi32>>
4646
! HLFIR: %[[BOX_DIMS]]:3 = fir.box_dims %[[V1]], %{{.*}} : (!fir.box<!fir.array<?xi32>>, index) -> (index, index, index)
4747
! HLFIR: %[[SHAPE:.*]] = fir.shape %[[BOX_DIMS]]#1 : (index) -> !fir.shape<1>
4848
! HLFIR: %[[ELEMENTAL:.*]] = hlfir.elemental %[[SHAPE]] unordered : (!fir.shape<1>) -> !hlfir.expr<?xi32> {
@@ -241,10 +241,7 @@
241241
! CHECK: }
242242
! HLFIR: acc.yield %[[DECLARE]]#0 : !fir.ref<!fir.array<100xf32>>
243243
! CHECK: } combiner {
244-
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<100xf32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<100xf32>>):
245-
! CHECK: %[[LB0:.*]] = arith.constant 0 : index
246-
! CHECK: %[[UB0:.*]] = arith.constant 99 : index
247-
! CHECK: %[[STEP0:.*]] = arith.constant 1 : index
244+
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<100xf32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<100xf32>>, %[[LB0:.*]]: index, %[[UB0:.*]]: index, %[[STEP0:.*]]: index):
248245
! CHECK: fir.do_loop %[[IV0:.*]] = %[[LB0]] to %[[UB0]] step %[[STEP0]] {
249246
! CHECK: %[[COORD1:.*]] = fir.coordinate_of %[[ARG0]], %[[IV0]] : (!fir.ref<!fir.array<100xf32>>, index) -> !fir.ref<f32>
250247
! CHECK: %[[COORD2:.*]] = fir.coordinate_of %[[ARG1]], %[[IV0]] : (!fir.ref<!fir.array<100xf32>>, index) -> !fir.ref<f32>
@@ -282,14 +279,8 @@
282279
! HLFIR: %[[DECLARE:.*]]:2 = hlfir.declare %[[ALLOCA]](%[[SHAPE]]) {uniq_name = "acc.reduction.init"} : (!fir.ref<!fir.array<100x10xi32>>, !fir.shape<2>) -> (!fir.ref<!fir.array<100x10xi32>>, !fir.ref<!fir.array<100x10xi32>>)
283280
! HLFIR: acc.yield %[[DECLARE]]#0 : !fir.ref<!fir.array<100x10xi32>>
284281
! CHECK: } combiner {
285-
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<100x10xi32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<100x10xi32>>):
286-
! CHECK: %[[LB0:.*]] = arith.constant 0 : index
287-
! CHECK: %[[UB0:.*]] = arith.constant 9 : index
288-
! CHECK: %[[STEP0:.*]] = arith.constant 1 : index
282+
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<100x10xi32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<100x10xi32>>, %[[LB0:.*]]: index, %[[UB0:.*]]: index, %[[STEP0:.*]]: index, %[[LB1:.*]]: index, %[[UB1:.*]]: index, %[[STEP1:.*]]: index):
289283
! CHECK: fir.do_loop %[[IV0:.*]] = %[[LB0]] to %[[UB0]] step %[[STEP0]] {
290-
! CHECK: %[[LB1:.*]] = arith.constant 0 : index
291-
! CHECK: %[[UB1:.*]] = arith.constant 99 : index
292-
! CHECK: %[[STEP1:.*]] = arith.constant 1 : index
293284
! CHECK: fir.do_loop %[[IV1:.*]] = %[[LB1]] to %[[UB1]] step %[[STEP1]] {
294285
! CHECK: %[[COORD1:.*]] = fir.coordinate_of %[[ARG0:.*]], %[[IV0]], %[[IV1]] : (!fir.ref<!fir.array<100x10xi32>>, index, index) -> !fir.ref<i32>
295286
! CHECK: %[[COORD2:.*]] = fir.coordinate_of %[[ARG1:.*]], %[[IV0]], %[[IV1]] : (!fir.ref<!fir.array<100x10xi32>>, index, index) -> !fir.ref<i32>
@@ -328,14 +319,8 @@
328319
! HLFIR: %[[DECLARE:.*]]:2 = hlfir.declare %[[ALLOCA]](%[[SHAPE]]) {uniq_name = "acc.reduction.init"} : (!fir.ref<!fir.array<100x10xf32>>, !fir.shape<2>) -> (!fir.ref<!fir.array<100x10xf32>>, !fir.ref<!fir.array<100x10xf32>>)
329320
! HLFIR: acc.yield %[[DECLARE]]#0 : !fir.ref<!fir.array<100x10xf32>>
330321
! CHECK: } combiner {
331-
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<100x10xf32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<100x10xf32>>):
332-
! CHECK: %[[LB0:.*]] = arith.constant 0 : index
333-
! CHECK: %[[UB0:.*]] = arith.constant 9 : index
334-
! CHECK: %[[STEP0:.*]] = arith.constant 1 : index
322+
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<100x10xf32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<100x10xf32>>, %[[LB0:.*]]: index, %[[UB0:.*]]: index, %[[STEP0:.*]]: index, %[[LB1:.*]]: index, %[[UB1:.*]]: index, %[[STEP1:.*]]: index):
335323
! CHECK: fir.do_loop %[[IV0:.*]] = %[[LB0]] to %[[UB0]] step %[[STEP0]] {
336-
! CHECK: %[[LB1:.*]] = arith.constant 0 : index
337-
! CHECK: %[[UB1:.*]] = arith.constant 99 : index
338-
! CHECK: %[[STEP1:.*]] = arith.constant 1 : index
339324
! CHECK: fir.do_loop %[[IV1:.*]] = %[[LB1]] to %[[UB1]] step %[[STEP1]] {
340325
! CHECK: %[[COORD1:.*]] = fir.coordinate_of %[[ARG0]], %[[IV0]], %[[IV1]] : (!fir.ref<!fir.array<100x10xf32>>, index, index) -> !fir.ref<f32>
341326
! CHECK: %[[COORD2:.*]] = fir.coordinate_of %[[ARG1]], %[[IV0]], %[[IV1]] : (!fir.ref<!fir.array<100x10xf32>>, index, index) -> !fir.ref<f32>
@@ -374,10 +359,7 @@
374359
! HLFIR: %[[DECLARE:.*]]:2 = hlfir.declare %[[ALLOCA]](%[[SHAPE]]) {uniq_name = "acc.reduction.init"} : (!fir.ref<!fir.array<100xi32>>, !fir.shape<1>) -> (!fir.ref<!fir.array<100xi32>>, !fir.ref<!fir.array<100xi32>>)
375360
! HLFIR: acc.yield %[[DECLARE]]#0 : !fir.ref<!fir.array<100xi32>>
376361
! CHECK: } combiner {
377-
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<100xi32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<100xi32>>):
378-
! CHECK: %[[LB0:.*]] = arith.constant 0 : index
379-
! CHECK: %[[UB0:.*]] = arith.constant 99 : index
380-
! CHECK: %[[STEP0:.*]] = arith.constant 1 : index
362+
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<100xi32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<100xi32>>, %[[LB0:.*]]: index, %[[UB0:.*]]: index, %[[STEP0:.*]]: index):
381363
! CHECK: fir.do_loop %[[IV0:.*]] = %[[LB0]] to %[[UB0]] step %[[STEP0]] {
382364
! CHECK: %[[COORD1:.*]] = fir.coordinate_of %[[ARG0]], %[[IV0]] : (!fir.ref<!fir.array<100xi32>>, index) -> !fir.ref<i32>
383365
! CHECK: %[[COORD2:.*]] = fir.coordinate_of %[[ARG1]], %[[IV0]] : (!fir.ref<!fir.array<100xi32>>, index) -> !fir.ref<i32>
@@ -431,11 +413,8 @@
431413
! HLFIR: %[[DECLARE:.*]]:2 = hlfir.declare %[[ALLOCA]](%[[SHAPE]]) {uniq_name = "acc.reduction.init"} : (!fir.ref<!fir.array<100xi32>>, !fir.shape<1>) -> (!fir.ref<!fir.array<100xi32>>, !fir.ref<!fir.array<100xi32>>)
432414
! HLFIR: acc.yield %[[DECLARE]]#0 : !fir.ref<!fir.array<100xi32>>
433415
! CHECK: } combiner {
434-
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<100xi32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<100xi32>>):
435-
! CHECK: %[[LB:.*]] = arith.constant 0 : index
436-
! CHECK: %[[UB:.*]] = arith.constant 99 : index
437-
! CHECK: %[[STEP:.*]] = arith.constant 1 : index
438-
! CHECK: fir.do_loop %[[IV:.*]] = %[[LB]] to %[[UB]] step %[[STEP]] {
416+
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<100xi32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<100xi32>>, %[[LB0:.*]]: index, %[[UB0:.*]]: index, %[[STEP0:.*]]: index):
417+
! CHECK: fir.do_loop %[[IV:.*]] = %[[LB0]] to %[[UB0]] step %[[STEP0]] {
439418
! CHECK: %[[COORD1:.*]] = fir.coordinate_of %[[ARG0]], %[[IV]] : (!fir.ref<!fir.array<100xi32>>, index) -> !fir.ref<i32>
440419
! CHECK: %[[COORD2:.*]] = fir.coordinate_of %[[ARG1]], %[[IV]] : (!fir.ref<!fir.array<100xi32>>, index) -> !fir.ref<i32>
441420
! CHECK: %[[LOAD1:.*]] = fir.load %[[COORD1]] : !fir.ref<i32>
@@ -470,11 +449,8 @@
470449
! HLFIR: %[[DECLARE:.*]]:2 = hlfir.declare %[[ALLOCA]](%[[SHAPE]]) {uniq_name = "acc.reduction.init"} : (!fir.ref<!fir.array<100xf32>>, !fir.shape<1>) -> (!fir.ref<!fir.array<100xf32>>, !fir.ref<!fir.array<100xf32>>)
471450
! HLFIR: acc.yield %[[DECLARE]]#0 : !fir.ref<!fir.array<100xf32>>
472451
! CHECK: } combiner {
473-
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<100xf32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<100xf32>>):
474-
! CHECK: %[[LB:.*]] = arith.constant 0 : index
475-
! CHECK: %[[UB:.*]] = arith.constant 99 : index
476-
! CHECK: %[[STEP:.*]] = arith.constant 1 : index
477-
! CHECK: fir.do_loop %[[IV:.*]] = %[[LB]] to %[[UB]] step %[[STEP]] {
452+
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<100xf32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<100xf32>>, %[[LB0:.*]]: index, %[[UB0:.*]]: index, %[[STEP0:.*]]: index):
453+
! CHECK: fir.do_loop %[[IV:.*]] = %[[LB0]] to %[[UB0]] step %[[STEP0]] {
478454
! CHECK: %[[COORD1:.*]] = fir.coordinate_of %[[ARG0]], %[[IV]] : (!fir.ref<!fir.array<100xf32>>, index) -> !fir.ref<f32>
479455
! CHECK: %[[COORD2:.*]] = fir.coordinate_of %[[ARG1]], %[[IV]] : (!fir.ref<!fir.array<100xf32>>, index) -> !fir.ref<f32>
480456
! CHECK: %[[LOAD1:.*]] = fir.load %[[COORD1]] : !fir.ref<f32>
@@ -509,18 +485,9 @@
509485
! HLFIR: %[[DECLARE:.*]]:2 = hlfir.declare %[[ALLOCA]](%[[SHAPE]]) {uniq_name = "acc.reduction.init"} : (!fir.ref<!fir.array<100x10x2xi32>>, !fir.shape<3>) -> (!fir.ref<!fir.array<100x10x2xi32>>, !fir.ref<!fir.array<100x10x2xi32>>)
510486
! HLFIR: acc.yield %[[DECLARE]]#0 : !fir.ref<!fir.array<100x10x2xi32>>
511487
! CHECK: } combiner {
512-
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<100x10x2xi32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<100x10x2xi32>>):
513-
! CHECK: %[[LB0:.*]] = arith.constant 0 : index
514-
! CHECK: %[[UB0:.*]] = arith.constant 1 : index
515-
! CHECK: %[[STEP0:.*]] = arith.constant 1 : index
488+
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<100x10x2xi32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<100x10x2xi32>>, %[[LB0:.*]]: index, %[[UB0:.*]]: index, %[[STEP0:.*]]: index, %[[LB1:.*]]: index, %[[UB1:.*]]: index, %[[STEP1:.*]]: index, %[[LB2:.*]]: index, %[[UB2:.*]]: index, %[[STEP2:.*]]: index):
516489
! CHECK: fir.do_loop %[[IV0:.*]] = %[[LB0]] to %[[UB0]] step %[[STEP0]] {
517-
! CHECK: %[[LB1:.*]] = arith.constant 0 : index
518-
! CHECK: %[[UB1:.*]] = arith.constant 9 : index
519-
! CHECK: %[[STEP1:.*]] = arith.constant 1 : index
520490
! CHECK: fir.do_loop %[[IV1:.*]] = %[[LB1]] to %[[UB1]] step %[[STEP1]] {
521-
! CHECK: %[[LB2:.*]] = arith.constant 0 : index
522-
! CHECK: %[[UB2:.*]] = arith.constant 99 : index
523-
! CHECK: %[[STEP2:.*]] = arith.constant 1 : index
524491
! CHECK: fir.do_loop %[[IV2:.*]] = %[[LB2]] to %[[UB2]] step %[[STEP2]] {
525492
! CHECK: %[[COORD1:.*]] = fir.coordinate_of %[[ARG0]], %[[IV0]], %[[IV1]], %[[IV2]] : (!fir.ref<!fir.array<100x10x2xi32>>, index, index, index) -> !fir.ref<i32>
526493
! CHECK: %[[COORD2:.*]] = fir.coordinate_of %[[ARG1]], %[[IV0]], %[[IV1]], %[[IV2]] : (!fir.ref<!fir.array<100x10x2xi32>>, index, index, index) -> !fir.ref<i32>
@@ -542,14 +509,8 @@
542509
! HLFIR: %[[DECLARE:.*]]:2 = hlfir.declare %[[ALLOCA]](%[[SHAPE]]) {uniq_name = "acc.reduction.init"} : (!fir.ref<!fir.array<100x10xi32>>, !fir.shape<2>) -> (!fir.ref<!fir.array<100x10xi32>>, !fir.ref<!fir.array<100x10xi32>>)
543510
! HLFIR: acc.yield %[[DECLARE]]#0 : !fir.ref<!fir.array<100x10xi32>>
544511
! CHECK: } combiner {
545-
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<100x10xi32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<100x10xi32>>):
546-
! CHECK: %[[LB0:.*]] = arith.constant 0 : index
547-
! CHECK: %[[UB0:.*]] = arith.constant 9 : index
548-
! CHECK: %[[STEP0:.*]] = arith.constant 1 : index
512+
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<100x10xi32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<100x10xi32>>, %[[LB0:.*]]: index, %[[UB0:.*]]: index, %[[STEP0:.*]]: index, %[[LB1:.*]]: index, %[[UB1:.*]]: index, %[[STEP1:.*]]: index):
549513
! CHECK: fir.do_loop %[[IV0:.*]] = %[[LB0]] to %[[UB0]] step %[[STEP0]] {
550-
! CHECK: %[[LB1:.*]] = arith.constant 0 : index
551-
! CHECK: %[[UB1:.*]] = arith.constant 99 : index
552-
! CHECK: %[[STEP1:.*]] = arith.constant 1 : index
553514
! CHECK: fir.do_loop %[[IV1:.*]] = %[[LB1]] to %[[UB1]] step %[[STEP1]] {
554515
! CHECK: %[[COORD1:.*]] = fir.coordinate_of %[[ARG0]], %[[IV0]], %[[IV1]] : (!fir.ref<!fir.array<100x10xi32>>, index, index) -> !fir.ref<i32>
555516
! CHECK: %[[COORD2:.*]] = fir.coordinate_of %[[ARG1]], %[[IV0]], %[[IV1]] : (!fir.ref<!fir.array<100x10xi32>>, index, index) -> !fir.ref<i32>
@@ -570,11 +531,8 @@
570531
! HLFIR: %[[DECLARE:.*]]:2 = hlfir.declare %[[ALLOCA]](%[[SHAPE]]) {uniq_name = "acc.reduction.init"} : (!fir.ref<!fir.array<100xi32>>, !fir.shape<1>) -> (!fir.ref<!fir.array<100xi32>>, !fir.ref<!fir.array<100xi32>>)
571532
! HFLIR: acc.yield %[[DECLARE]]#0 : !fir.ref<!fir.array<100xi32>>
572533
! CHECK: } combiner {
573-
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<100xi32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<100xi32>>):
574-
! CHECK: %[[LB:.*]] = arith.constant 0 : index
575-
! CHECK: %[[UB:.*]] = arith.constant 99 : index
576-
! CHECK: %[[STEP:.*]] = arith.constant 1 : index
577-
! CHECK: fir.do_loop %[[IV:.*]] = %[[LB]] to %[[UB]] step %[[STEP]] {
534+
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<100xi32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<100xi32>>, %[[LB0:.*]]: index, %[[UB0:.*]]: index, %[[STEP0:.*]]: index):
535+
! CHECK: fir.do_loop %[[IV:.*]] = %[[LB0]] to %[[UB0]] step %[[STEP0]] {
578536
! CHECK: %[[COORD1:.*]] = fir.coordinate_of %[[ARG0]], %[[IV]] : (!fir.ref<!fir.array<100xi32>>, index) -> !fir.ref<i32>
579537
! CHECK: %[[COORD2:.*]] = fir.coordinate_of %[[ARG1]], %[[IV]] : (!fir.ref<!fir.array<100xi32>>, index) -> !fir.ref<i32>
580538
! CHECK: %[[LOAD1:.*]] = fir.load %[[COORD1]] : !fir.ref<i32>

0 commit comments

Comments
 (0)