brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · f062dcb Raw
23 lines · plain
1// REQUIRES: asserts2// RUN: fir-opt %s -pass-pipeline='builtin.module(func.func(test-fir-alias-analysis))' -debug-only=fir-alias-analysis --mlir-disable-threading 2>&1 | FileCheck %s3 4// Verify that a CUF allocation is recognized as SourceKind::Allocate by5// fir::AliasAnalysis::getSource.6 7module {8  func.func @_QQmain() attributes {fir.bindc_name = "TEST"} {9    // Allocate two independent device arrays and tag the results; with10    // value-scoped MemAlloc handling in AA, these should be classified as11    // Allocate and not alias.12    %a = cuf.alloc !fir.box<!fir.heap<!fir.array<?xf32>>> {bindc_name = "a1", data_attr = #cuf.cuda<device>, uniq_name = "_QFEa1", test.ptr = "cuf_alloc_a"} -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>13    %b = cuf.alloc !fir.box<!fir.heap<!fir.array<?xf32>>> {bindc_name = "a2", data_attr = #cuf.cuda<device>, uniq_name = "_QFEa2", test.ptr = "cuf_alloc_b"} -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>14    return15  }16}17 18// CHECK-LABEL: Testing : "_QQmain"19// Distinct allocations should not alias.20// CHECK: cuf_alloc_a#0 <-> cuf_alloc_b#0: NoAlias21 22 23