Skip to content

Commit e0cd781

Browse files
authored
[flang][openacc] Fix getBoundsString for reduction recipe name (#68146)
`getBoundsString` is used to generate the reduction recipe names when an array section is provided. The lowerbound and upperbound were swapped. This patch fixes it.
1 parent 27254ae commit e0cd781

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

flang/lib/Lower/OpenACC.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,8 @@ std::string getBoundsString(llvm::SmallVector<mlir::Value> &bounds) {
492492
fir::getIntIfConstant(boundsOp.getLowerbound()) &&
493493
boundsOp.getUpperbound() &&
494494
fir::getIntIfConstant(boundsOp.getUpperbound())) {
495-
boundStr << "lb" << *fir::getIntIfConstant(boundsOp.getUpperbound())
496-
<< ".ub" << *fir::getIntIfConstant(boundsOp.getLowerbound());
495+
boundStr << "lb" << *fir::getIntIfConstant(boundsOp.getLowerbound())
496+
<< ".ub" << *fir::getIntIfConstant(boundsOp.getUpperbound());
497497
} else if (boundsOp.getExtent() &&
498498
fir::getIntIfConstant(boundsOp.getExtent())) {
499499
boundStr << "ext" << *fir::getIntIfConstant(boundsOp.getExtent());

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ subroutine acc_reduction_add_static_slice(a)
10591059
! CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[C1]] : index) startIdx(%[[C1]] : index)
10601060
! FIR: %[[RED:.*]] = acc.reduction varPtr(%[[ARG0]] : !fir.ref<!fir.array<100xi32>>) bounds(%[[BOUND]]) -> !fir.ref<!fir.array<100xi32>> {name = "a(11:20)"}
10611061
! HLFIR: %[[RED:.*]] = acc.reduction varPtr(%[[DECLARG0]]#1 : !fir.ref<!fir.array<100xi32>>) bounds(%[[BOUND]]) -> !fir.ref<!fir.array<100xi32>> {name = "a(11:20)"}
1062-
! CHECK: acc.parallel reduction(@reduction_add_section_lb19.ub10_ref_100xi32 -> %[[RED]] : !fir.ref<!fir.array<100xi32>>)
1062+
! CHECK: acc.parallel reduction(@reduction_add_section_lb10.ub19_ref_100xi32 -> %[[RED]] : !fir.ref<!fir.array<100xi32>>)
10631063

10641064
subroutine acc_reduction_add_dynamic_extent_add(a)
10651065
integer :: a(:)

0 commit comments

Comments
 (0)