1 // Test hlfir.assign rewrite in the bufferization pass.
2 // Assign in itself is not transformed, but its operands may be
3 // expressions that are bufferized and must be updated.
4 // RUN: fir-opt %s -bufferize-hlfir | FileCheck %s
6 func.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 true
8 %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>>>>>
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>>>>>