diff --git a/flang/docs/Aliasing.md b/flang/docs/Aliasing.md index d5edf59f37c6e..8d81e14762364 100644 --- a/flang/docs/Aliasing.md +++ b/flang/docs/Aliasing.md @@ -281,14 +281,18 @@ print *, target end ``` -Optimizations assume that Cray pointers do not alias any other variables. -In the above example, it is assumed that `handle` and `target` do not alias, -and optimizations will treat them as separate entities. +By default, optimizations assume that Cray pointers do not alias any other +variables. In the above example, it is assumed that `handle` and `target` do +not alias, and optimizations will treat them as separate entities. In order to disable optimizations that assume that there is no aliasing between Cray pointer targets and entities they alias with, add the TARGET attribute to variables aliasing with a Cray pointer (the `target` variable in this example). +There is also a flag `-mmlir -funsafe-cray-pointers` which causes the compiler +to assume that cray pointers alias with all data whether or not it has the +TARGET attribute. + ## Type considerations Pointers with distinct types may alias so long as their types are diff --git a/flang/include/flang/Optimizer/Analysis/AliasAnalysis.h b/flang/include/flang/Optimizer/Analysis/AliasAnalysis.h index 30dd5f754d0b5..455100ff3c003 100644 --- a/flang/include/flang/Optimizer/Analysis/AliasAnalysis.h +++ b/flang/include/flang/Optimizer/Analysis/AliasAnalysis.h @@ -45,7 +45,7 @@ struct AliasAnalysis { Unknown); /// Attributes of the memory source object. - ENUM_CLASS(Attribute, Target, Pointer, IntentIn); + ENUM_CLASS(Attribute, Target, Pointer, IntentIn, CrayPointer, CrayPointee); // See // https://discourse.llvm.org/t/rfc-distinguish-between-data-and-non-data-in-fir-alias-analysis/78759/1 @@ -161,6 +161,15 @@ struct AliasAnalysis { /// Return true, if Pointer attribute is set. bool isPointer() const; + /// Return true, if CrayPointer attribute is set. + bool isCrayPointer() const; + + /// Return true, if CrayPointee attribute is set. + bool isCrayPointee() const; + + /// Return true, if CrayPointer or CrayPointee attribute is set. + bool isCrayPointerOrPointee() const; + bool isDummyArgument() const; bool isData() const; bool isBoxData() const; diff --git a/flang/include/flang/Optimizer/Dialect/FIRAttr.td b/flang/include/flang/Optimizer/Dialect/FIRAttr.td index 8a8c60ff0722b..5e3185480a7eb 100644 --- a/flang/include/flang/Optimizer/Dialect/FIRAttr.td +++ b/flang/include/flang/Optimizer/Dialect/FIRAttr.td @@ -36,13 +36,17 @@ def FIRvolatile : I32BitEnumAttrCaseBit<"fortran_volatile", 12, "volatile">; def FIRHostAssoc : I32BitEnumAttrCaseBit<"host_assoc", 13>; // Used inside parent procedure to flag variables host associated in internal procedure. def FIRInternalAssoc : I32BitEnumAttrCaseBit<"internal_assoc", 14>; +// Used by alias analysis +def FIRcray_pointer : I32BitEnumAttrCaseBit<"cray_pointer", 15>; +def FIRcray_pointee : I32BitEnumAttrCaseBit<"cray_pointee", 16>; def fir_FortranVariableFlagsEnum : I32BitEnumAttr< "FortranVariableFlagsEnum", "Fortran variable attributes", [FIRnoAttributes, FIRallocatable, FIRasynchronous, FIRbind_c, FIRcontiguous, FIRintent_in, FIRintent_inout, FIRintent_out, FIRoptional, FIRparameter, - FIRpointer, FIRtarget, FIRvalue, FIRvolatile, FIRHostAssoc, FIRInternalAssoc]> { + FIRpointer, FIRtarget, FIRvalue, FIRvolatile, FIRHostAssoc, FIRInternalAssoc, + FIRcray_pointer, FIRcray_pointee]> { let separator = ", "; let cppNamespace = "::fir"; let printBitEnumPrimaryGroups = 1; diff --git a/flang/include/flang/Optimizer/Dialect/FortranVariableInterface.td b/flang/include/flang/Optimizer/Dialect/FortranVariableInterface.td index f89be52cf835d..4bdb13fb54708 100644 --- a/flang/include/flang/Optimizer/Dialect/FortranVariableInterface.td +++ b/flang/include/flang/Optimizer/Dialect/FortranVariableInterface.td @@ -114,6 +114,20 @@ def fir_FortranVariableOpInterface : OpInterface<"FortranVariableOpInterface"> { fir::FortranVariableFlagsEnum::pointer); } + /// Is this variable a Cray pointer? + bool isCrayPointer() { + auto attrs = getFortranAttrs(); + return attrs && bitEnumContainsAny(*attrs, + fir::FortranVariableFlagsEnum::cray_pointer); + } + + /// Is this variable a Cray pointee? + bool isCrayPointee() { + auto attrs = getFortranAttrs(); + return attrs && bitEnumContainsAny(*attrs, + fir::FortranVariableFlagsEnum::cray_pointee); + } + /// Is this variable a Fortran allocatable? bool isAllocatable() { auto attrs = getFortranAttrs(); diff --git a/flang/lib/Lower/ConvertVariable.cpp b/flang/lib/Lower/ConvertVariable.cpp index 53d4d7566acfa..0ededb364bfea 100644 --- a/flang/lib/Lower/ConvertVariable.cpp +++ b/flang/lib/Lower/ConvertVariable.cpp @@ -1806,6 +1806,9 @@ fir::FortranVariableFlagsAttr Fortran::lower::translateSymbolAttributes( if (sym.test(Fortran::semantics::Symbol::Flag::CrayPointee)) { // CrayPointee are represented as pointers. flags = flags | fir::FortranVariableFlagsEnum::pointer; + // Still use the CrayPointee flag so that AliasAnalysis can handle these + // separately. + flags = flags | fir::FortranVariableFlagsEnum::cray_pointee; return fir::FortranVariableFlagsAttr::get(mlirContext, flags); } const auto &attrs = sym.attrs(); @@ -1835,6 +1838,8 @@ fir::FortranVariableFlagsAttr Fortran::lower::translateSymbolAttributes( flags = flags | fir::FortranVariableFlagsEnum::value; if (attrs.test(Fortran::semantics::Attr::VOLATILE)) flags = flags | fir::FortranVariableFlagsEnum::fortran_volatile; + if (sym.test(Fortran::semantics::Symbol::Flag::CrayPointer)) + flags = flags | fir::FortranVariableFlagsEnum::cray_pointer; if (flags == fir::FortranVariableFlagsEnum::None) return {}; return fir::FortranVariableFlagsAttr::get(mlirContext, flags); diff --git a/flang/lib/Optimizer/Analysis/AliasAnalysis.cpp b/flang/lib/Optimizer/Analysis/AliasAnalysis.cpp index 0e956d89fd0ee..c1ea88c96e43f 100644 --- a/flang/lib/Optimizer/Analysis/AliasAnalysis.cpp +++ b/flang/lib/Optimizer/Analysis/AliasAnalysis.cpp @@ -21,12 +21,18 @@ #include "mlir/Interfaces/SideEffectInterfaces.h" #include "llvm/ADT/TypeSwitch.h" #include "llvm/Support/Casting.h" +#include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" using namespace mlir; #define DEBUG_TYPE "fir-alias-analysis" +llvm::cl::opt supportCrayPointers( + "funsafe-cray-pointers", + llvm::cl::desc("Support Cray POINTERs that ALIAS with non-TARGET data"), + llvm::cl::init(false)); + // Inspect for value-scoped Allocate effects and determine whether // 'candidate' is a new allocation. Returns SourceKind::Allocate if a // MemAlloc effect is attached @@ -60,6 +66,10 @@ getAttrsFromVariable(fir::FortranVariableOpInterface var) { attrs.set(fir::AliasAnalysis::Attribute::Pointer); if (var.isIntentIn()) attrs.set(fir::AliasAnalysis::Attribute::IntentIn); + if (var.isCrayPointer()) + attrs.set(fir::AliasAnalysis::Attribute::CrayPointer); + if (var.isCrayPointee()) + attrs.set(fir::AliasAnalysis::Attribute::CrayPointee); return attrs; } @@ -138,6 +148,18 @@ bool AliasAnalysis::Source::isPointer() const { return attributes.test(Attribute::Pointer); } +bool AliasAnalysis::Source::isCrayPointee() const { + return attributes.test(Attribute::CrayPointee); +} + +bool AliasAnalysis::Source::isCrayPointer() const { + return attributes.test(Attribute::CrayPointer); +} + +bool AliasAnalysis::Source::isCrayPointerOrPointee() const { + return isCrayPointer() || isCrayPointee(); +} + bool AliasAnalysis::Source::isDummyArgument() const { if (auto v = origin.u.dyn_cast()) { return fir::isDummyArgument(v); @@ -224,6 +246,15 @@ AliasResult AliasAnalysis::alias(Source lhsSrc, Source rhsSrc, mlir::Value lhs, return AliasResult::MayAlias; } + // Cray pointers/pointees can alias with anything via LOC. + if (supportCrayPointers) { + if (lhsSrc.isCrayPointerOrPointee() || rhsSrc.isCrayPointerOrPointee()) { + LLVM_DEBUG(llvm::dbgs() + << " aliasing because of Cray pointer/pointee\n"); + return AliasResult::MayAlias; + } + } + if (lhsSrc.kind == rhsSrc.kind) { // If the kinds and origins are the same, then lhs and rhs must alias unless // either source is approximate. Approximate sources are for parts of the diff --git a/flang/test/Analysis/AliasAnalysis/alias-analysis-cray-pointers.fir b/flang/test/Analysis/AliasAnalysis/alias-analysis-cray-pointers.fir new file mode 100644 index 0000000000000..4df3f67915b9c --- /dev/null +++ b/flang/test/Analysis/AliasAnalysis/alias-analysis-cray-pointers.fir @@ -0,0 +1,60 @@ +// Check that cray pointers might alias with everything. + +// RUN: fir-opt %s -funsafe-cray-pointers -pass-pipeline='builtin.module(func.func(test-fir-alias-analysis))' -mlir-disable-threading 2>&1 | FileCheck %s +// RUN: fir-opt %s -pass-pipeline='builtin.module(func.func(test-fir-alias-analysis))' -mlir-disable-threading 2>&1 | FileCheck --check-prefix=DEFAULT %s + +// Fortran source: +// subroutine test() +// real :: a, b +// pointer(p, a) +// p = loc(b) +// end subroutine + +// CHECK-LABEL: Testing : "_QPtest" +// CHECK-DAG: p#0 <-> b#0: MayAlias +// CHECK-DAG: p#1 <-> b#0: MayAlias +// CHECK-DAG: p#0 <-> b#1: MayAlias +// CHECK-DAG: p#1 <-> b#1: MayAlias +// CHECK-DAG: p#0 <-> a#0: MayAlias +// CHECK-DAG: p#1 <-> a#0: MayAlias +// CHECK-DAG: b#0 <-> a#0: MayAlias +// CHECK-DAG: b#1 <-> a#0: MayAlias +// CHECK-DAG: p#0 <-> a#1: MayAlias +// CHECK-DAG: p#1 <-> a#1: MayAlias +// CHECK-DAG: b#0 <-> a#1: MayAlias +// CHECK-DAG: b#1 <-> a#1: MayAlias + +// By default, alias analysis assumes that cray pointers do not alias with +// non-target data. See flang/docs/Aliasing.md. +// DEFAULT-LABEL: Testing : "_QPtest" +// DEFAULT-DAG: p#0 <-> b#0: NoAlias +// DEFAULT-DAG: p#1 <-> b#0: NoAlias +// DEFAULT-DAG: p#0 <-> b#1: NoAlias +// DEFAULT-DAG: p#1 <-> b#1: NoAlias +// DEFAULT-DAG: p#0 <-> a#0: NoAlias +// DEFAULT-DAG: p#1 <-> a#0: NoAlias +// DEFAULT-DAG: b#0 <-> a#0: NoAlias +// DEFAULT-DAG: b#1 <-> a#0: NoAlias +// DEFAULT-DAG: p#0 <-> a#1: NoAlias +// DEFAULT-DAG: p#1 <-> a#1: NoAlias +// DEFAULT-DAG: b#0 <-> a#1: NoAlias +// DEFAULT-DAG: b#1 <-> a#1: NoAlias + +func.func @_QPtest() { + %0 = fir.alloca !fir.box> + %1 = fir.dummy_scope : !fir.dscope + %2 = fir.alloca i64 {bindc_name = "p", uniq_name = "_QFtestEp"} + %3:2 = hlfir.declare %2 {test.ptr = "p", fortran_attrs = #fir.var_attrs, uniq_name = "_QFtestEp"} : (!fir.ref) -> (!fir.ref, !fir.ref) + %4 = fir.alloca f32 {bindc_name = "b", uniq_name = "_QFtestEb"} + %5:2 = hlfir.declare %4 {test.ptr = "b", uniq_name = "_QFtestEb"} : (!fir.ref) -> (!fir.ref, !fir.ref) + %6:2 = hlfir.declare %0 {test.ptr = "a", fortran_attrs = #fir.var_attrs, uniq_name = "_QFtestEa"} : (!fir.ref>>) -> (!fir.ref>>, !fir.ref>>) + %7 = fir.zero_bits !fir.ptr + %8 = fir.embox %7 : (!fir.ptr) -> !fir.box> + fir.store %8 to %6#0 : !fir.ref>> + %9 = fir.embox %5#0 : (!fir.ref) -> !fir.box + %10 = fir.box_addr %9 : (!fir.box) -> !fir.ref + %11 = fir.convert %10 : (!fir.ref) -> i64 + hlfir.assign %11 to %3#0 : i64, !fir.ref + return +} + diff --git a/flang/test/Lower/HLFIR/cray-pointers.f90 b/flang/test/Lower/HLFIR/cray-pointers.f90 index 082aa1ef8c3f2..9c67b960951df 100644 --- a/flang/test/Lower/HLFIR/cray-pointers.f90 +++ b/flang/test/Lower/HLFIR/cray-pointers.f90 @@ -10,10 +10,10 @@ end subroutine test1 ! CHECK-LABEL: func.func @_QPtest1() { ! CHECK: %[[VAL_0:.*]] = fir.alloca !fir.box>> ! CHECK: %[[VAL_1:.*]] = fir.alloca i64 {bindc_name = "cp", uniq_name = "_QFtest1Ecp"} -! CHECK: %[[VAL_2:.*]]:2 = hlfir.declare %[[VAL_1]] {uniq_name = "_QFtest1Ecp"} : (!fir.ref) -> (!fir.ref, !fir.ref) +! CHECK: %[[VAL_2:.*]]:2 = hlfir.declare %[[VAL_1]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest1Ecp"} : (!fir.ref) -> (!fir.ref, !fir.ref) ! CHECK: %[[VAL_5:.*]] = arith.constant 10 : index ! CHECK: %[[VAL_7:.*]] = fir.shape %[[VAL_5]] : (index) -> !fir.shape<1> -! CHECK: %[[VAL_12:.*]]:2 = hlfir.declare %[[VAL_0]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest1Ex"} : (!fir.ref>>>) -> (!fir.ref>>>, !fir.ref>>>) +! CHECK: %[[VAL_12:.*]]:2 = hlfir.declare %[[VAL_0]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest1Ex"} : (!fir.ref>>>) -> (!fir.ref>>>, !fir.ref>>>) ! CHECK: %[[VAL_13:.*]] = fir.zero_bits !fir.ptr> ! CHECK: %[[VAL_14:.*]] = fir.embox %[[VAL_13]](%[[VAL_7]]) : (!fir.ptr>, !fir.shape<1>) -> !fir.box>> ! CHECK: fir.store %[[VAL_14]] to %[[VAL_12]]#0 : !fir.ref>>> @@ -37,9 +37,9 @@ end subroutine test2 ! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref {fir.bindc_name = "n"}) { ! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.box>> ! CHECK: %[[VAL_2:.*]] = fir.alloca i64 {bindc_name = "cp", uniq_name = "_QFtest2Ecp"} -! CHECK: %[[VAL_3:.*]]:2 = hlfir.declare %[[VAL_2]] {uniq_name = "_QFtest2Ecp"} : (!fir.ref) -> (!fir.ref, !fir.ref) +! CHECK: %[[VAL_3:.*]]:2 = hlfir.declare %[[VAL_2]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest2Ecp"} : (!fir.ref) -> (!fir.ref, !fir.ref) ! CHECK: %[[VAL_19:.*]] = fir.shape_shift %{{.*}}, %{{.*}} : (index, index) -> !fir.shapeshift<1> -! CHECK: %[[VAL_24:.*]]:2 = hlfir.declare %[[VAL_1]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest2Ex"} : (!fir.ref>>>) -> (!fir.ref>>>, !fir.ref>>>) +! CHECK: %[[VAL_24:.*]]:2 = hlfir.declare %[[VAL_1]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest2Ex"} : (!fir.ref>>>) -> (!fir.ref>>>, !fir.ref>>>) ! CHECK: %[[VAL_25:.*]] = fir.zero_bits !fir.ptr> ! CHECK: %[[VAL_26:.*]] = fir.embox %[[VAL_25]](%[[VAL_19]]) : (!fir.ptr>, !fir.shapeshift<1>) -> !fir.box>> ! CHECK: fir.store %[[VAL_26]] to %[[VAL_24]]#0 : !fir.ref>>> @@ -63,11 +63,11 @@ end subroutine test3 ! CHECK-SAME: %[[VAL_1:.*]]: !fir.ref {fir.bindc_name = "n"}) { ! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.box>>> ! CHECK: %[[VAL_3:.*]]:2 = hlfir.declare %[[VAL_1]] dummy_scope %{{[0-9]+}} arg {{[0-9]+}} {uniq_name = "_QFtest3En"} : (!fir.ref, !fir.dscope) -> (!fir.ref, !fir.ref) -! CHECK: %[[VAL_4:.*]]:2 = hlfir.declare %[[VAL_0]] dummy_scope %{{[0-9]+}} arg {{[0-9]+}} {uniq_name = "_QFtest3Ecp"} : (!fir.ref, !fir.dscope) -> (!fir.ref, !fir.ref) +! CHECK: %[[VAL_4:.*]]:2 = hlfir.declare %[[VAL_0]] dummy_scope %{{[0-9]+}} arg {{[0-9]+}} {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest3Ecp"} : (!fir.ref, !fir.dscope) -> (!fir.ref, !fir.ref) ! CHECK: %[[VAL_5:.*]] = arith.constant 11 : index ! CHECK: %[[VAL_8:.*]] = arith.constant 11 : index ! CHECK: %[[VAL_24:.*]] = fir.shape_shift %{{.*}}, %{{.*}} : (index, index) -> !fir.shapeshift<1> -! CHECK: %[[VAL_29:.*]]:2 = hlfir.declare %[[VAL_2]] typeparams %[[VAL_8]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest3Ec"} : (!fir.ref>>>>, index) -> (!fir.ref>>>>, !fir.ref>>>>) +! CHECK: %[[VAL_29:.*]]:2 = hlfir.declare %[[VAL_2]] typeparams %[[VAL_8]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest3Ec"} : (!fir.ref>>>>, index) -> (!fir.ref>>>>, !fir.ref>>>>) ! CHECK: %[[VAL_30:.*]] = fir.zero_bits !fir.ptr>> ! CHECK: %[[VAL_31:.*]] = fir.embox %[[VAL_30]](%[[VAL_24]]) : (!fir.ptr>>, !fir.shapeshift<1>) -> !fir.box>>> ! CHECK: fir.store %[[VAL_31]] to %[[VAL_29]]#0 : !fir.ref>>>> @@ -90,12 +90,12 @@ end subroutine test4 ! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.box>> ! CHECK: %[[VAL_2:.*]]:2 = hlfir.declare %[[VAL_0]] dummy_scope %{{[0-9]+}} arg {{[0-9]+}} {uniq_name = "_QFtest4En"} : (!fir.ref, !fir.dscope) -> (!fir.ref, !fir.ref) ! CHECK: %[[VAL_3:.*]] = fir.alloca i64 {bindc_name = "cp", uniq_name = "_QFtest4Ecp"} -! CHECK: %[[VAL_4:.*]]:2 = hlfir.declare %[[VAL_3]] {uniq_name = "_QFtest4Ecp"} : (!fir.ref) -> (!fir.ref, !fir.ref) +! CHECK: %[[VAL_4:.*]]:2 = hlfir.declare %[[VAL_3]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest4Ecp"} : (!fir.ref) -> (!fir.ref, !fir.ref) ! CHECK: %[[VAL_5:.*]] = fir.load %[[VAL_2]]#0 : !fir.ref ! CHECK: %[[VAL_6:.*]] = arith.constant 0 : i32 ! CHECK: %[[VAL_7:.*]] = arith.cmpi sgt, %[[VAL_5]], %[[VAL_6]] : i32 ! CHECK: %[[VAL_8:.*]] = arith.select %[[VAL_7]], %[[VAL_5]], %[[VAL_6]] : i32 -! CHECK: %[[VAL_13:.*]]:2 = hlfir.declare %[[VAL_1]] typeparams %[[VAL_8]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest4Ec"} : (!fir.ref>>>, i32) -> (!fir.ref>>>, !fir.ref>>>) +! CHECK: %[[VAL_13:.*]]:2 = hlfir.declare %[[VAL_1]] typeparams %[[VAL_8]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest4Ec"} : (!fir.ref>>>, i32) -> (!fir.ref>>>, !fir.ref>>>) ! CHECK: %[[VAL_14:.*]] = fir.zero_bits !fir.ptr> ! CHECK: %[[VAL_15:.*]] = fir.embox %[[VAL_14]] typeparams %[[VAL_8]] : (!fir.ptr>, i32) -> !fir.box>> ! CHECK: fir.store %[[VAL_15]] to %[[VAL_13]]#0 : !fir.ref>>> @@ -122,11 +122,11 @@ end subroutine test5 ! CHECK-LABEL: func.func @_QPtest5() { ! CHECK: %[[VAL_0:.*]] = fir.alloca !fir.box>>> ! CHECK: %[[VAL_1:.*]] = fir.alloca i64 {bindc_name = "cp", uniq_name = "_QFtest5Ecp"} -! CHECK: %[[VAL_2:.*]]:2 = hlfir.declare %[[VAL_1]] {uniq_name = "_QFtest5Ecp"} : (!fir.ref) -> (!fir.ref, !fir.ref) +! CHECK: %[[VAL_2:.*]]:2 = hlfir.declare %[[VAL_1]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest5Ecp"} : (!fir.ref) -> (!fir.ref, !fir.ref) ! CHECK: %[[VAL_5:.*]] = arith.constant 3 : index ! CHECK: %[[VAL_6:.*]] = arith.constant 9 : index ! CHECK: %[[VAL_8:.*]] = fir.shape_shift %[[VAL_5]], %[[VAL_6]] : (index, index) -> !fir.shapeshift<1> -! CHECK: %[[VAL_13:.*]]:2 = hlfir.declare %[[VAL_0]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest5Ev"} : (!fir.ref>>>>) -> (!fir.ref>>>>, !fir.ref>>>>) +! CHECK: %[[VAL_13:.*]]:2 = hlfir.declare %[[VAL_0]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest5Ev"} : (!fir.ref>>>>) -> (!fir.ref>>>>, !fir.ref>>>>) ! CHECK: %[[VAL_14:.*]] = fir.zero_bits !fir.ptr>> ! CHECK: %[[VAL_15:.*]] = fir.embox %[[VAL_14]](%[[VAL_8]]) : (!fir.ptr>>, !fir.shapeshift<1>) -> !fir.box>>> ! CHECK: fir.store %[[VAL_15]] to %[[VAL_13]]#0 : !fir.ref>>>> @@ -155,7 +155,7 @@ end subroutine test6 ! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.box>>> ! CHECK: %[[VAL_3:.*]]:2 = hlfir.declare %[[VAL_0]] dummy_scope %{{[0-9]+}} arg {{[0-9]+}} {uniq_name = "_QFtest6En"} : (!fir.ref, !fir.dscope) -> (!fir.ref, !fir.ref) ! CHECK: %[[VAL_4:.*]] = fir.alloca i64 {bindc_name = "cp", uniq_name = "_QFtest6Ecp"} -! CHECK: %[[VAL_5:.*]]:2 = hlfir.declare %[[VAL_4]] {uniq_name = "_QFtest6Ecp"} : (!fir.ref) -> (!fir.ref, !fir.ref) +! CHECK: %[[VAL_5:.*]]:2 = hlfir.declare %[[VAL_4]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest6Ecp"} : (!fir.ref) -> (!fir.ref, !fir.ref) ! CHECK: %[[VAL_8:.*]] = fir.load %[[VAL_3]]#0 : !fir.ref ! CHECK: %[[VAL_9:.*]] = arith.constant 0 : i32 ! CHECK: %[[VAL_10:.*]] = arith.cmpi sgt, %[[VAL_8]], %[[VAL_9]] : i32 @@ -163,13 +163,13 @@ end subroutine test6 ! CHECK: %[[VAL_12:.*]] = arith.constant 20 : index ! CHECK: %[[VAL_14:.*]] = fir.shape %[[VAL_12]] : (index) -> !fir.shape<1> -! CHECK: %[[VAL_20:.*]]:2 = hlfir.declare %[[VAL_2]] typeparams %[[VAL_11]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest6Ec"} : (!fir.ref>>>>, i32) -> (!fir.ref>>>>, !fir.ref>>>>) +! CHECK: %[[VAL_20:.*]]:2 = hlfir.declare %[[VAL_2]] typeparams %[[VAL_11]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest6Ec"} : (!fir.ref>>>>, i32) -> (!fir.ref>>>>, !fir.ref>>>>) ! CHECK: %[[VAL_21:.*]] = fir.zero_bits !fir.ptr>> ! CHECK: %[[VAL_22:.*]] = fir.embox %[[VAL_21]](%[[VAL_14]]) typeparams %[[VAL_11]] : (!fir.ptr>>, !fir.shape<1>, i32) -> !fir.box>>> ! CHECK: fir.store %[[VAL_22]] to %[[VAL_20]]#0 : !fir.ref>>>> ! CHECK: %[[VAL_41:.*]] = fir.shape_shift %{{.*}}, %{{.*}} : (index, index) -> !fir.shapeshift<1> -! CHECK: %[[VAL_46:.*]]:2 = hlfir.declare %[[VAL_1]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest6Ex"} : (!fir.ref>>>) -> (!fir.ref>>>, !fir.ref>>>) +! CHECK: %[[VAL_46:.*]]:2 = hlfir.declare %[[VAL_1]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest6Ex"} : (!fir.ref>>>) -> (!fir.ref>>>, !fir.ref>>>) ! CHECK: %[[VAL_47:.*]] = fir.zero_bits !fir.ptr> ! CHECK: %[[VAL_48:.*]] = fir.embox %[[VAL_47]](%[[VAL_41]]) : (!fir.ptr>, !fir.shapeshift<1>) -> !fir.box>> ! CHECK: fir.store %[[VAL_48]] to %[[VAL_46]]#0 : !fir.ref>>> @@ -205,10 +205,10 @@ end subroutine test7 ! CHECK: %[[VAL_4:.*]] = fir.shape %[[VAL_2]] : (index) -> !fir.shape<1> ! CHECK: %[[VAL_5:.*]]:2 = hlfir.declare %[[VAL_3]](%[[VAL_4]]) {uniq_name = "_QFtest7Earr"} : (!fir.ref>, !fir.shape<1>) -> (!fir.ref>, !fir.ref>) ! CHECK: %[[VAL_12:.*]] = fir.alloca i64 {bindc_name = "ptr", uniq_name = "_QFtest7Eptr"} -! CHECK: %[[VAL_13:.*]]:2 = hlfir.declare %[[VAL_12]] {uniq_name = "_QFtest7Eptr"} : (!fir.ref) -> (!fir.ref, !fir.ref) +! CHECK: %[[VAL_13:.*]]:2 = hlfir.declare %[[VAL_12]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest7Eptr"} : (!fir.ref) -> (!fir.ref, !fir.ref) ! CHECK: %[[VAL_6:.*]] = arith.constant 5 : index ! CHECK: %[[VAL_8:.*]] = fir.shape %[[VAL_6]] : (index) -> !fir.shape<1> -! CHECK: %[[VAL_9:.*]]:2 = hlfir.declare %[[VAL_1]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest7Epte"} : (!fir.ref>>>) -> (!fir.ref>>>, !fir.ref>>>) +! CHECK: %[[VAL_9:.*]]:2 = hlfir.declare %[[VAL_1]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest7Epte"} : (!fir.ref>>>) -> (!fir.ref>>>, !fir.ref>>>) ! CHECK: %[[VAL_10:.*]] = fir.zero_bits !fir.ptr> ! CHECK: %[[VAL_11:.*]] = fir.embox %[[VAL_10]](%[[VAL_8]]) : (!fir.ptr>, !fir.shape<1>) -> !fir.box>> ! CHECK: fir.store %[[VAL_11]] to %[[VAL_9]]#0 : !fir.ref>>> @@ -227,10 +227,10 @@ end subroutine test8 ! CHECK-LABEL: func.func @_QPtest8( ! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.box>> ! CHECK: %[[VAL_8:.*]] = fir.alloca i64 {bindc_name = "ptr", uniq_name = "_QFtest8Eptr"} -! CHECK: %[[VAL_9:.*]]:2 = hlfir.declare %[[VAL_8]] {uniq_name = "_QFtest8Eptr"} : (!fir.ref) -> (!fir.ref, !fir.ref) +! CHECK: %[[VAL_9:.*]]:2 = hlfir.declare %[[VAL_8]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest8Eptr"} : (!fir.ref) -> (!fir.ref, !fir.ref) ! CHECK: %[[VAL_2:.*]] = arith.constant 5 : index ! CHECK: %[[VAL_4:.*]] = fir.shape %[[VAL_2]] : (index) -> !fir.shape<1> -! CHECK: %[[VAL_5:.*]]:2 = hlfir.declare %[[VAL_1]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest8Epte"} : (!fir.ref>>>) -> (!fir.ref>>>, !fir.ref>>>) +! CHECK: %[[VAL_5:.*]]:2 = hlfir.declare %[[VAL_1]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest8Epte"} : (!fir.ref>>>) -> (!fir.ref>>>, !fir.ref>>>) ! CHECK: %[[VAL_6:.*]] = fir.zero_bits !fir.ptr> ! CHECK: %[[VAL_7:.*]] = fir.embox %[[VAL_6]](%[[VAL_4]]) : (!fir.ptr>, !fir.shape<1>) -> !fir.box>> ! CHECK: fir.store %[[VAL_7]] to %[[VAL_5]]#0 : !fir.ref>>> @@ -257,10 +257,10 @@ end subroutine test9 ! CHECK-LABEL: func.func @_QPtest9( ! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.box>> ! CHECK: %[[VAL_8:.*]] = fir.alloca i64 {bindc_name = "ptr", uniq_name = "_QFtest9Eptr"} -! CHECK: %[[VAL_9:.*]]:2 = hlfir.declare %[[VAL_8]] {uniq_name = "_QFtest9Eptr"} : (!fir.ref) -> (!fir.ref, !fir.ref) +! CHECK: %[[VAL_9:.*]]:2 = hlfir.declare %[[VAL_8]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest9Eptr"} : (!fir.ref) -> (!fir.ref, !fir.ref) ! CHECK: %[[VAL_2:.*]] = arith.constant 5 : index ! CHECK: %[[VAL_4:.*]] = fir.shape %[[VAL_2]] : (index) -> !fir.shape<1> -! CHECK: %[[VAL_5:.*]]:2 = hlfir.declare %[[VAL_1]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest9Epte"} : (!fir.ref>>>) -> (!fir.ref>>>, !fir.ref>>>) +! CHECK: %[[VAL_5:.*]]:2 = hlfir.declare %[[VAL_1]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest9Epte"} : (!fir.ref>>>) -> (!fir.ref>>>, !fir.ref>>>) ! CHECK: %[[VAL_6:.*]] = fir.zero_bits !fir.ptr> ! CHECK: %[[VAL_7:.*]] = fir.embox %[[VAL_6]](%[[VAL_4]]) : (!fir.ptr>, !fir.shape<1>) -> !fir.box>> ! CHECK: fir.store %[[VAL_7]] to %[[VAL_5]]#0 : !fir.ref>>> @@ -288,8 +288,8 @@ end subroutine test10 ! CHECK-LABEL: func.func @_QPtest10( ! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.box> ! CHECK: %[[VAL_6:.*]] = fir.alloca i64 {bindc_name = "ptr", uniq_name = "_QFtest10Eptr"} -! CHECK: %[[VAL_7:.*]]:2 = hlfir.declare %[[VAL_6]] {uniq_name = "_QFtest10Eptr"} : (!fir.ref) -> (!fir.ref, !fir.ref) -! CHECK: %[[VAL_3:.*]]:2 = hlfir.declare %[[VAL_1]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest10Epte"} : (!fir.ref>>) -> (!fir.ref>>, !fir.ref>>) +! CHECK: %[[VAL_7:.*]]:2 = hlfir.declare %[[VAL_6]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest10Eptr"} : (!fir.ref) -> (!fir.ref, !fir.ref) +! CHECK: %[[VAL_3:.*]]:2 = hlfir.declare %[[VAL_1]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest10Epte"} : (!fir.ref>>) -> (!fir.ref>>, !fir.ref>>) ! CHECK: %[[VAL_4:.*]] = fir.zero_bits !fir.ptr ! CHECK: %[[VAL_5:.*]] = fir.embox %[[VAL_4]] : (!fir.ptr) -> !fir.box> ! CHECK: fir.store %[[VAL_5]] to %[[VAL_3]]#0 : !fir.ref>> @@ -316,8 +316,8 @@ end subroutine test11 ! CHECK-LABEL: func.func @_QPtest11( ! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.box> ! CHECK: %[[VAL_6:.*]] = fir.alloca i64 {bindc_name = "ptr", uniq_name = "_QFtest11Eptr"} -! CHECK: %[[VAL_7:.*]]:2 = hlfir.declare %[[VAL_6]] {uniq_name = "_QFtest11Eptr"} : (!fir.ref) -> (!fir.ref, !fir.ref) -! CHECK: %[[VAL_3:.*]]:2 = hlfir.declare %[[VAL_1]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest11Epte"} : (!fir.ref>>) -> (!fir.ref>>, !fir.ref>>) +! CHECK: %[[VAL_7:.*]]:2 = hlfir.declare %[[VAL_6]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest11Eptr"} : (!fir.ref) -> (!fir.ref, !fir.ref) +! CHECK: %[[VAL_3:.*]]:2 = hlfir.declare %[[VAL_1]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest11Epte"} : (!fir.ref>>) -> (!fir.ref>>, !fir.ref>>) ! CHECK: %[[VAL_4:.*]] = fir.zero_bits !fir.ptr ! CHECK: %[[VAL_5:.*]] = fir.embox %[[VAL_4]] : (!fir.ptr) -> !fir.box> ! CHECK: fir.store %[[VAL_5]] to %[[VAL_3]]#0 : !fir.ref>> @@ -346,8 +346,8 @@ subroutine test_hidden_pointer ! CHECK-LABEL: func.func @_QPtest_hidden_pointer() { ! CHECK: %[[VAL_0:.*]] = fir.alloca !fir.box> ! CHECK: %[[VAL_1:.*]] = fir.address_of(@_QMtest_modEcray_pointer) : !fir.ref -! CHECK: %[[VAL_2:.*]]:2 = hlfir.declare %[[VAL_1]] {uniq_name = "_QMtest_modEcray_pointer"} : (!fir.ref) -> (!fir.ref, !fir.ref) -! CHECK: %[[VAL_3:.*]]:2 = hlfir.declare %[[VAL_0]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QMtest_modEcray_pointee"} : (!fir.ref>>) -> (!fir.ref>>, !fir.ref>>) +! CHECK: %[[VAL_2:.*]]:2 = hlfir.declare %[[VAL_1]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QMtest_modEcray_pointer"} : (!fir.ref) -> (!fir.ref, !fir.ref) +! CHECK: %[[VAL_3:.*]]:2 = hlfir.declare %[[VAL_0]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QMtest_modEcray_pointee"} : (!fir.ref>>) -> (!fir.ref>>, !fir.ref>>) ! CHECK: %[[VAL_4:.*]] = fir.zero_bits !fir.ptr ! CHECK: %[[VAL_5:.*]] = fir.embox %[[VAL_4]] : (!fir.ptr) -> !fir.box> ! CHECK: fir.store %[[VAL_5]] to %[[VAL_3]]#0 : !fir.ref>> @@ -381,12 +381,12 @@ subroutine internal() ! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.box>> ! CHECK: %[[VAL_2:.*]]:2 = hlfir.declare %[[VAL_0]] dummy_scope %{{[0-9]+}} arg {{[0-9]+}} {uniq_name = "_QFtest_craypointer_captureEn"} : (!fir.ref, !fir.dscope) -> (!fir.ref, !fir.ref) ! CHECK: %[[VAL_3:.*]] = fir.alloca i64 {bindc_name = "cray_pointer", uniq_name = "_QFtest_craypointer_captureEcray_pointer"} -! CHECK: %[[VAL_4:.*]]:2 = hlfir.declare %[[VAL_3]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest_craypointer_captureEcray_pointer"} : (!fir.ref) -> (!fir.ref, !fir.ref) +! CHECK: %[[VAL_4:.*]]:2 = hlfir.declare %[[VAL_3]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest_craypointer_captureEcray_pointer"} : (!fir.ref) -> (!fir.ref, !fir.ref) ! CHECK: %[[VAL_5:.*]] = fir.load %[[VAL_2]]#0 : !fir.ref ! CHECK: %[[VAL_6:.*]] = arith.constant 0 : i32 ! CHECK: %[[VAL_7:.*]] = arith.cmpi sgt, %[[VAL_5]], %[[VAL_6]] : i32 ! CHECK: %[[VAL_8:.*]] = arith.select %[[VAL_7]], %[[VAL_5]], %[[VAL_6]] : i32 -! CHECK: %[[VAL_9:.*]]:2 = hlfir.declare %[[VAL_1]] typeparams %[[VAL_8]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest_craypointer_captureEcray_pointee"} : (!fir.ref>>>, i32) -> (!fir.ref>>>, !fir.ref>>>) +! CHECK: %[[VAL_9:.*]]:2 = hlfir.declare %[[VAL_1]] typeparams %[[VAL_8]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest_craypointer_captureEcray_pointee"} : (!fir.ref>>>, i32) -> (!fir.ref>>>, !fir.ref>>>) ! CHECK: %[[VAL_10:.*]] = fir.zero_bits !fir.ptr> ! CHECK: %[[VAL_11:.*]] = fir.embox %[[VAL_10]] typeparams %[[VAL_8]] : (!fir.ptr>, i32) -> !fir.box>> ! CHECK: fir.store %[[VAL_11]] to %[[VAL_9]]#0 : !fir.ref>>> @@ -408,11 +408,11 @@ subroutine internal() ! CHECK: %[[VAL_3:.*]] = fir.load %[[VAL_2]] : !fir.llvm_ptr>>>> ! CHECK: %[[VAL_4:.*]] = fir.load %[[VAL_3]] : !fir.ref>>> ! CHECK: %[[VAL_5:.*]] = fir.box_elesize %[[VAL_4]] : (!fir.box>>) -> index -! CHECK: %[[VAL_6:.*]]:2 = hlfir.declare %[[VAL_3]] typeparams %[[VAL_5]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest_craypointer_captureEcray_pointee"} : (!fir.ref>>>, index) -> (!fir.ref>>>, !fir.ref>>>) +! CHECK: %[[VAL_6:.*]]:2 = hlfir.declare %[[VAL_3]] typeparams %[[VAL_5]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest_craypointer_captureEcray_pointee"} : (!fir.ref>>>, index) -> (!fir.ref>>>, !fir.ref>>>) ! CHECK: %[[VAL_7:.*]] = arith.constant 1 : i32 ! CHECK: %[[VAL_8:.*]] = fir.coordinate_of %[[VAL_0]], %[[VAL_7]] : (!fir.ref>>>, !fir.ref>>, i32) -> !fir.llvm_ptr> ! CHECK: %[[VAL_9:.*]] = fir.load %[[VAL_8]] : !fir.llvm_ptr> -! CHECK: %[[VAL_10:.*]]:2 = hlfir.declare %[[VAL_9]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest_craypointer_captureEcray_pointer"} : (!fir.ref) -> (!fir.ref, !fir.ref) +! CHECK: %[[VAL_10:.*]]:2 = hlfir.declare %[[VAL_9]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFtest_craypointer_captureEcray_pointer"} : (!fir.ref) -> (!fir.ref, !fir.ref) ! CHECK: %[[VAL_11:.*]] = fir.convert %[[VAL_10]]#0 : (!fir.ref) -> !fir.ref> ! CHECK: %[[VAL_12:.*]] = fir.load %[[VAL_11]] : !fir.ref> ! CHECK: %[[VAL_13:.*]] = fir.convert %[[VAL_6]]#0 : (!fir.ref>>>) -> !fir.ref> diff --git a/flang/test/Lower/Intrinsics/free.f90 b/flang/test/Lower/Intrinsics/free.f90 index 1bfe48f550754..b90b1f57d5d4c 100644 --- a/flang/test/Lower/Intrinsics/free.f90 +++ b/flang/test/Lower/Intrinsics/free.f90 @@ -7,8 +7,8 @@ subroutine free_ptr() pointer (ptr_x, x) ! CHECK: %[[X:.*]] = fir.alloca !fir.box> ! CHECK: %[[X_PTR:.*]] = fir.alloca i64 {bindc_name = "ptr_x", uniq_name = "_QFfree_ptrEptr_x"} - ! CHECK: %[[X_PTR_DECL:.*]]:2 = hlfir.declare %[[X_PTR]] {uniq_name = "_QFfree_ptrEptr_x"} : (!fir.ref) -> (!fir.ref, !fir.ref) - ! CHECK: %[[X_DECL:.*]]:2 = hlfir.declare %[[X]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFfree_ptrEx"} : (!fir.ref>>) -> (!fir.ref>>, !fir.ref>>) + ! CHECK: %[[X_PTR_DECL:.*]]:2 = hlfir.declare %[[X_PTR]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFfree_ptrEptr_x"} : (!fir.ref) -> (!fir.ref, !fir.ref) + ! CHECK: %[[X_DECL:.*]]:2 = hlfir.declare %[[X]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFfree_ptrEx"} : (!fir.ref>>) -> (!fir.ref>>, !fir.ref>>) ! CHECK: %[[X_LD:.*]] = fir.load %[[X_PTR_DECL]]#0 : !fir.ref ! CHECK: fir.call @_FortranAFree(%[[X_LD]]) fastmath : (i64) -> () ! CHECK: return diff --git a/flang/test/Lower/Intrinsics/malloc.f90 b/flang/test/Lower/Intrinsics/malloc.f90 index 4a9b65bf7ae18..28004273f9a08 100644 --- a/flang/test/Lower/Intrinsics/malloc.f90 +++ b/flang/test/Lower/Intrinsics/malloc.f90 @@ -7,7 +7,7 @@ subroutine malloc_ptr() pointer (ptr_x, x) ! CHECK: %[[X:.*]] = fir.alloca !fir.box> ! CHECK: %[[X_PTR:.*]] = fir.alloca i64 {bindc_name = "ptr_x", uniq_name = "_QFmalloc_ptrEptr_x"} - ! CHECK: %[[X_PTR_DECL:.*]]:2 = hlfir.declare %[[X_PTR]] {uniq_name = "_QFmalloc_ptrEptr_x"} : (!fir.ref) -> (!fir.ref, !fir.ref) + ! CHECK: %[[X_PTR_DECL:.*]]:2 = hlfir.declare %[[X_PTR]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFmalloc_ptrEptr_x"} : (!fir.ref) -> (!fir.ref, !fir.ref) ! CHECK: %[[CST:.*]] = arith.constant 4 : i32 ! CHECK: %[[CST_I64:.*]] = fir.convert %[[CST]] : (i32) -> i64 ! CHECK: %[[ALLOC:.*]] = fir.call @_FortranAMalloc(%[[CST_I64]]) fastmath : (i64) -> i64 diff --git a/flang/test/Lower/OpenMP/cray-pointers01.f90 b/flang/test/Lower/OpenMP/cray-pointers01.f90 index 01c6b8bbce260..8fcddbcdcb0f8 100644 --- a/flang/test/Lower/OpenMP/cray-pointers01.f90 +++ b/flang/test/Lower/OpenMP/cray-pointers01.f90 @@ -13,8 +13,8 @@ module test_host_assoc_cray_pointer subroutine set_cray_pointer ! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.box>> ! CHECK: %[[IVAR_ADDR:.*]] = fir.address_of(@_QMtest_host_assoc_cray_pointerEivar) : !fir.ref - ! CHECK: %[[IVAR_DECL:.*]]:2 = hlfir.declare %[[IVAR_ADDR]] {uniq_name = "_QMtest_host_assoc_cray_pointerEivar"} : (!fir.ref) -> (!fir.ref, !fir.ref) - ! CHECK: %[[VAR_DECL:.*]]:2 = hlfir.declare %[[ALLOCA]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QMtest_host_assoc_cray_pointerEvar"} : (!fir.ref>>>) -> (!fir.ref>>>, !fir.ref>>>) + ! CHECK: %[[IVAR_DECL:.*]]:2 = hlfir.declare %[[IVAR_ADDR]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QMtest_host_assoc_cray_pointerEivar"} : (!fir.ref) -> (!fir.ref, !fir.ref) + ! CHECK: %[[VAR_DECL:.*]]:2 = hlfir.declare %[[ALLOCA]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QMtest_host_assoc_cray_pointerEvar"} : (!fir.ref>>>) -> (!fir.ref>>>, !fir.ref>>>) real*8 pointee(2) pointee(1) = 42.0 @@ -36,16 +36,16 @@ program test_cray_pointers_01 real*8 :: var(*) ! CHECK: %[[BOX_ALLOCA:.*]] = fir.alloca !fir.box>> ! CHECK: %[[IVAR_ALLOCA:.*]] = fir.alloca i64 {bindc_name = "ivar", uniq_name = "_QFEivar"} - ! CHECK: %[[IVAR_DECL_01:.*]]:2 = hlfir.declare %[[IVAR_ALLOCA]] {uniq_name = "_QFEivar"} : (!fir.ref) -> (!fir.ref, !fir.ref) + ! CHECK: %[[IVAR_DECL_01:.*]]:2 = hlfir.declare %[[IVAR_ALLOCA]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFEivar"} : (!fir.ref) -> (!fir.ref, !fir.ref) pointer(ivar,var) - ! CHECK: %[[VAR_DECL_02:.*]]:2 = hlfir.declare %[[BOX_ALLOCA]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFEvar"} : (!fir.ref>>>) -> (!fir.ref>>>, !fir.ref>>>) + ! CHECK: %[[VAR_DECL_02:.*]]:2 = hlfir.declare %[[BOX_ALLOCA]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFEvar"} : (!fir.ref>>>) -> (!fir.ref>>>, !fir.ref>>>) real*8 pointee(2) pointee(1) = 42.0 !$omp parallel default(none) private(ivar) shared(pointee) ! CHECK: omp.parallel private({{.*}} %[[IVAR_DECL_01]]#0 -> %[[ARG0:.*]] : !fir.ref) { - ! CHECK: %[[IVAR_DECL_02:.*]]:2 = hlfir.declare %[[ARG0]] {uniq_name = "_QFEivar"} : (!fir.ref) -> (!fir.ref, !fir.ref) + ! CHECK: %[[IVAR_DECL_02:.*]]:2 = hlfir.declare %[[ARG0]] {fortran_attrs = #fir.var_attrs, uniq_name = "_QFEivar"} : (!fir.ref) -> (!fir.ref, !fir.ref) ! CHECK: hlfir.assign %{{.*}} to %[[IVAR_DECL_02]]#0 : i64, !fir.ref ivar = loc(pointee) ! CHECK: fir.call @_FortranAPointerAssociateScalar({{.*}}) fastmath : (!fir.ref>, !fir.llvm_ptr) -> ()