[flang-commits] [flang] [flang][Lower] Convert OMP Map and related functions to evaluate::Expr (PR #81626)
Krzysztof Parzyszek via flang-commits
flang-commits at lists.llvm.org
Mon Mar 18 10:01:38 PDT 2024
================
@@ -808,14 +808,83 @@ genBaseBoundsOps(fir::FirOpBuilder &builder, mlir::Location loc,
return bounds;
}
+namespace detail {
+template <typename T> //
+static T &&AsRvalueRef(T &&t) {
+ return std::move(t);
+}
+template <typename T> //
+static T AsRvalueRef(T &t) {
+ return t;
+}
+template <typename T> //
+static T AsRvalueRef(const T &t) {
+ return t;
+}
+
+// Helper class for stripping enclosing parentheses and a conversion that
+// preserves type category. This is used for triplet elements, which are
+// always of type integer(kind=8). The lower/upper bounds are converted to
+// an "index" type, which is 64-bit, so the explicit conversion to kind=8
----------------
kparzysz wrote:
One specific difference below. There are several instances of this with different variables. The name is in `acc.create`, second line from the end in each snippet.
```
1,9c1,11
< %28 = fir.convert %27 : (i32) -> index
< %29 = arith.subi %28, %6 : index
< %30 = fir.load %3#0 : !fir.ref<i32>
< %31 = fir.convert %30 : (i32) -> index
< %32 = arith.subi %31, %6 : index
< %33 = acc.bounds lowerbound(%29 : index) upperbound(%32 : index) extent(%13 : index) stride(%26#2 : index) startIdx(%6 : index) {strideInBytes = true}
< %34 = fir.box_addr %15#0 : (!fir.box<!fir.array<?xf32>>) -> !fir.ref<!fir.array<?xf32>>
< %35 = acc.create varPtr(%34 : !fir.ref<!fir.array<?xf32>>) bounds(%33) -> !fir.ref<!fir.array<?xf32>> {name = "b(n:m)", structured = false}
< acc.enter_data dataOperands(%35 : !fir.ref<!fir.array<?xf32>>)
---
> %28 = fir.convert %27 : (i32) -> i64
> %29 = fir.convert %28 : (i64) -> index
> %30 = arith.subi %29, %6 : index
> %31 = fir.load %3#0 : !fir.ref<i32>
> %32 = fir.convert %31 : (i32) -> i64
> %33 = fir.convert %32 : (i64) -> index
> %34 = arith.subi %33, %6 : index
> %35 = acc.bounds lowerbound(%30 : index) upperbound(%34 : index) extent(%13 : index) stride(%26#2 : index) startIdx(%6 : index) {strideInBytes = true}
> %36 = fir.box_addr %15#0 : (!fir.box<!fir.array<?xf32>>) -> !fir.ref<!fir.array<?xf32>>
> %37 = acc.create varPtr(%36 : !fir.ref<!fir.array<?xf32>>) bounds(%35) -> !fir.ref<!fir.array<?xf32>> {name = "b(int(n,kind=8):int(m,kind=8))", structured = false}
> acc.enter_data dataOperands(%37 : !fir.ref<!fir.array<?xf32>>)
```
https://github.com/llvm/llvm-project/pull/81626
More information about the flang-commits
mailing list