brintos

brintos / llvm-project-archived public Read only

0
0
Text · 714 B · 1a6aa7b Raw
23 lines · plain
1// Test that FIR codegen handles cases when free and malloc have2// already been defined in FIR (either by the user in Fortran via3// BIND(C) or by some FIR pass in between).4// RUN: fir-opt --fir-to-llvm-ir %s | FileCheck %s5 6 7func.func @already_declared_free_malloc() {8  %c4 = arith.constant 4 : index9  %0 = fir.call @malloc(%c4) : (index) -> !fir.heap<i32>10  fir.call @free(%0) : (!fir.heap<i32>) -> ()11  %1 = fir.allocmem i3212  fir.freemem %1 : !fir.heap<i32>13  return14}15 16// CHECK: llvm.call @malloc(%{{.*}})17// CHECK: llvm.call @free(%{{.*}})18// CHECK: llvm.call @malloc(%{{.*}})19// CHECK: llvm.call @free(%{{.*}})20 21func.func private @free(!fir.heap<i32>)22func.func private @malloc(index) -> !fir.heap<i32>23