mirror of
https://github.com/intel/llvm.git
synced 2026-01-27 06:06:34 +08:00
Revert "[flang][openacc] Fix lowerbound when there is no subscripts"
This reverts commit 626aa8518d.
This commit is contained in:
@@ -146,10 +146,12 @@ genBaseBoundsOps(fir::FirOpBuilder &builder, mlir::Location loc,
|
||||
mlir::Value baseLb =
|
||||
fir::factory::readLowerBound(builder, loc, dataExv, dim, one);
|
||||
mlir::Value ext = fir::factory::readExtent(builder, loc, dataExv, dim);
|
||||
mlir::Value lb = builder.createIntegerConstant(loc, idxTy, 0);
|
||||
mlir::Value lb =
|
||||
baseLb == one ? builder.createIntegerConstant(loc, idxTy, 0) : baseLb;
|
||||
|
||||
// ub = extent - 1
|
||||
mlir::Value ub = builder.create<mlir::arith::SubIOp>(loc, ext, one);
|
||||
// ub = baseLb + extent - 1
|
||||
mlir::Value lbExt = builder.create<mlir::arith::AddIOp>(loc, ext, baseLb);
|
||||
mlir::Value ub = builder.create<mlir::arith::SubIOp>(loc, lbExt, one);
|
||||
mlir::Value bound = builder.create<mlir::acc::DataBoundsOp>(
|
||||
loc, boundTy, lb, ub, mlir::Value(), one, false, baseLb);
|
||||
bounds.push_back(bound);
|
||||
|
||||
@@ -18,10 +18,12 @@ subroutine acc_enter_data
|
||||
!$acc enter data create(a)
|
||||
!CHECK: %[[ONE:.*]] = arith.constant 1 : index
|
||||
!CHECK: %[[LB:.*]] = arith.constant 0 : index
|
||||
!CHECK: %[[UB:.*]] = arith.subi %[[C10]], %[[ONE]] : index
|
||||
!CHECK: %[[LBEXT:.*]] = arith.addi %[[C10]], %[[ONE]] : index
|
||||
!CHECK: %[[UB:.*]] = arith.subi %[[LBEXT]], %[[ONE]] : index
|
||||
!CHECK: %[[BOUND0:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[ONE]] : index) startIdx(%[[ONE]] : index)
|
||||
!CHECK: %[[LB:.*]] = arith.constant 0 : index
|
||||
!CHECK: %[[UB:.*]] = arith.subi %[[EXTENT_C10]], %[[ONE]] : index
|
||||
!CHECK: %[[LBEXT:.*]] = arith.addi %[[EXTENT_C10]], %[[ONE]] : index
|
||||
!CHECK: %[[UB:.*]] = arith.subi %[[LBEXT]], %[[ONE]] : index
|
||||
!CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[ONE]] : index) startIdx(%[[ONE]] : index)
|
||||
!CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref<!fir.array<10x10xf32>>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref<!fir.array<10x10xf32>> {name = "a", structured = false}
|
||||
!CHECK: acc.enter_data dataOperands(%[[CREATE_A]] : !fir.ref<!fir.array<10x10xf32>>){{$}}
|
||||
@@ -29,10 +31,12 @@ subroutine acc_enter_data
|
||||
!$acc enter data create(a) if(.true.)
|
||||
!CHECK: %[[ONE:.*]] = arith.constant 1 : index
|
||||
!CHECK: %[[LB:.*]] = arith.constant 0 : index
|
||||
!CHECK: %[[UB:.*]] = arith.subi %[[C10]], %[[ONE]] : index
|
||||
!CHECK: %[[LBEXT:.*]] = arith.addi %[[C10]], %[[ONE]] : index
|
||||
!CHECK: %[[UB:.*]] = arith.subi %[[LBEXT]], %[[ONE]] : index
|
||||
!CHECK: %[[BOUND0:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[ONE]] : index) startIdx(%[[ONE]] : index)
|
||||
!CHECK: %[[LB:.*]] = arith.constant 0 : index
|
||||
!CHECK: %[[UB:.*]] = arith.subi %[[EXTENT_C10]], %[[ONE]] : index
|
||||
!CHECK: %[[LBEXT:.*]] = arith.addi %[[EXTENT_C10]], %[[ONE]] : index
|
||||
!CHECK: %[[UB:.*]] = arith.subi %[[LBEXT]], %[[ONE]] : index
|
||||
!CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[ONE]] : index) startIdx(%[[ONE]] : index)
|
||||
!CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref<!fir.array<10x10xf32>>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref<!fir.array<10x10xf32>> {name = "a", structured = false}
|
||||
!CHECK: [[IF1:%.*]] = arith.constant true
|
||||
@@ -41,10 +45,12 @@ subroutine acc_enter_data
|
||||
!$acc enter data create(a) if(ifCondition)
|
||||
!CHECK: %[[ONE:.*]] = arith.constant 1 : index
|
||||
!CHECK: %[[LB:.*]] = arith.constant 0 : index
|
||||
!CHECK: %[[UB:.*]] = arith.subi %[[C10]], %[[ONE]] : index
|
||||
!CHECK: %[[LBEXT:.*]] = arith.addi %[[C10]], %[[ONE]] : index
|
||||
!CHECK: %[[UB:.*]] = arith.subi %[[LBEXT]], %[[ONE]] : index
|
||||
!CHECK: %[[BOUND0:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[ONE]] : index) startIdx(%[[ONE]] : index)
|
||||
!CHECK: %[[LB:.*]] = arith.constant 0 : index
|
||||
!CHECK: %[[UB:.*]] = arith.subi %[[EXTENT_C10]], %[[ONE]] : index
|
||||
!CHECK: %[[LBEXT:.*]] = arith.addi %[[EXTENT_C10]], %[[ONE]] : index
|
||||
!CHECK: %[[UB:.*]] = arith.subi %[[LBEXT]], %[[ONE]] : index
|
||||
!CHECK: %[[BOUND1:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[ONE]] : index) startIdx(%[[ONE]] : index)
|
||||
!CHECK: %[[CREATE_A:.*]] = acc.create varPtr(%[[A]] : !fir.ref<!fir.array<10x10xf32>>) bounds(%[[BOUND0]], %[[BOUND1]]) -> !fir.ref<!fir.array<10x10xf32>> {name = "a", structured = false}
|
||||
!CHECK: [[IFCOND:%.*]] = fir.load %{{.*}} : !fir.ref<!fir.logical<4>>
|
||||
@@ -260,7 +266,6 @@ end subroutine
|
||||
! Test lowering of array section for non default lower bound.
|
||||
subroutine acc_enter_data_non_default_lb()
|
||||
integer :: a(0:9)
|
||||
integer :: b(11:20)
|
||||
|
||||
!CHECK-LABEL: func.func @_QPacc_enter_data_non_default_lb() {
|
||||
!CHECK: %[[BASELB:.*]] = arith.constant 0 : index
|
||||
@@ -301,14 +306,6 @@ subroutine acc_enter_data_non_default_lb()
|
||||
!CHECK: %[[UB:.*]] = arith.subi %[[LBEXT]], %[[ONE]] : index
|
||||
!CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[ONE]] : index) startIdx(%[[BASELB]] : index)
|
||||
!CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[A]] : !fir.ref<!fir.array<10xi32>>) bounds(%[[BOUND]]) -> !fir.ref<!fir.array<10xi32>> {name = "a(4:)", structured = false}
|
||||
!CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref<!fir.array<10xi32>>)
|
||||
|
||||
!$acc enter data create(b)
|
||||
!CHECK: %[[ONE:.*]] = arith.constant 1 : index
|
||||
!CHECK: %[[LB:.*]] = arith.constant 0 : index
|
||||
!CHECK: %[[UB:.*]] = arith.subi %c10{{.*}}, %[[ONE]] : index
|
||||
!CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[ONE]] : index) startIdx(%c11{{.*}} : index)
|
||||
!CHECK: %[[CREATE:.*]] = acc.create varPtr(%1 : !fir.ref<!fir.array<10xi32>>) bounds(%[[BOUND]]) -> !fir.ref<!fir.array<10xi32>> {name = "b", structured = false}
|
||||
!CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref<!fir.array<10xi32>>)
|
||||
|
||||
end subroutine
|
||||
@@ -601,7 +598,8 @@ subroutine acc_enter_data_derived_type()
|
||||
!CHECK: %[[C10:.*]] = arith.constant 10 : index
|
||||
!CHECK: %[[C1:.*]] = arith.constant 1 : index
|
||||
!CHECK: %[[LB:.*]] = arith.constant 0 : index
|
||||
!CHECK: %[[UB:.*]] = arith.subi %[[C10]], %[[C1]] : index
|
||||
!CHECK: %[[LBEXT:.*]] = arith.addi %[[C10]], %[[C1]] : index
|
||||
!CHECK: %[[UB:.*]] = arith.subi %[[LBEXT]], %[[C1]] : index
|
||||
!CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[C1]] : index) startIdx(%[[C1]] : index)
|
||||
!CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[ARRAY_COORD]] : !fir.ref<!fir.array<10xf32>>) bounds(%[[BOUND]]) -> !fir.ref<!fir.array<10xf32>> {name = "a%array", structured = false}
|
||||
!CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref<!fir.array<10xf32>>)
|
||||
@@ -657,7 +655,8 @@ subroutine acc_enter_data_derived_type()
|
||||
!CHECK: %[[C10:.*]] = arith.constant 10 : index
|
||||
!CHECK: %[[C1:.*]] = arith.constant 1 : index
|
||||
!CHECK: %[[LB:.*]] = arith.constant 0 : index
|
||||
!CHECK: %[[UB:.*]] = arith.subi %[[C10]], %[[C1]] : index
|
||||
!CHECK: %[[LBEXT:.*]] = arith.addi %[[C10]], %[[C1]] : index
|
||||
!CHECK: %[[UB:.*]] = arith.subi %[[LBEXT]], %[[C1]] : index
|
||||
!CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[C1]] : index) startIdx(%[[C1]] : index)
|
||||
!CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[ARRAY_COORD]] : !fir.ref<!fir.array<10xf32>>) bounds(%[[BOUND]]) -> !fir.ref<!fir.array<10xf32>> {name = "b%d%array", structured = false}
|
||||
|
||||
@@ -688,7 +687,8 @@ subroutine acc_enter_data_derived_type()
|
||||
!CHECK: %[[C10:.*]] = arith.constant 10 : index
|
||||
!CHECK: %[[C1:.*]] = arith.constant 1 : index
|
||||
!CHECK: %[[LB:.*]] = arith.constant 0 : index
|
||||
!CHECK: %[[UB:.*]] = arith.subi %[[C10]], %[[C1]] : index
|
||||
!CHECK: %[[LBEXT:.*]] = arith.addi %[[C10]], %[[C1]] : index
|
||||
!CHECK: %[[UB:.*]] = arith.subi %[[LBEXT]], %[[C1]] : index
|
||||
!CHECK: %[[BOUND:.*]] = acc.bounds lowerbound(%[[LB]] : index) upperbound(%[[UB]] : index) stride(%[[C1]] : index) startIdx(%[[C1]] : index)
|
||||
!CHECK: %[[CREATE:.*]] = acc.create varPtr(%[[ARRAY_COORD]] : !fir.ref<!fir.array<10xf32>>) bounds(%[[BOUND]]) -> !fir.ref<!fir.array<10xf32>> {name = "d%d(1_8)%array", structured = false}
|
||||
!CHECK: acc.enter_data dataOperands(%[[CREATE]] : !fir.ref<!fir.array<10xf32>>)
|
||||
|
||||
Reference in New Issue
Block a user