brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · 7c3a608 Raw
17 lines · plain
1// Test hlfir.assign rewrite in the bufferization pass.2// Assign in itself is not transformed, but its operands may be3// expressions that are bufferized and must be updated.4// RUN: fir-opt %s -bufferize-hlfir | FileCheck %s5 6func.func @keep_attributes(%arg0: !fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,8>>>>>, %arg1: !fir.box<!fir.array<1x!fir.char<1,?>>>) {7  %true = arith.constant true8  %0 = hlfir.as_expr %arg1 move %true : (!fir.box<!fir.array<1x!fir.char<1,?>>>, i1) -> !hlfir.expr<1x!fir.char<1,?>>9  hlfir.assign %0 to %arg0 realloc keep_lhs_len : !hlfir.expr<1x!fir.char<1,?>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,8>>>>>10  return11}12 13// CHECK-LABEL: func.func @keep_attributes(14// CHECK-SAME: %[[X:.*]]: !fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,8>>>>>,15// CHECK-SAME: %[[Y:.*]]: !fir.box<!fir.array<1x!fir.char<1,?>>>) {16// CHECK: hlfir.assign %[[Y]] to %[[X]] realloc keep_lhs_len : !fir.box<!fir.array<1x!fir.char<1,?>>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,8>>>>>17