[flang-commits] [PATCH] D114104: [FIR] Convert fir.allocmem and fir.freemem operations to calls to malloc and free, respectively

Alexis Perry-Holby via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Dec 3 11:36:40 PST 2021


AlexisPerry marked an inline comment as done.
AlexisPerry added a comment.

Address review comments - add a test that triggers the TODO in AllocMemOp Conversion



================
Comment at: flang/lib/Optimizer/CodeGen/CodeGen.cpp:907
+    auto ity = lowerTy().indexType();
+    if (auto recTy = fir::unwrapSequenceType(heap.getAllocatedType())
+                         .dyn_cast<fir::RecordType>())
----------------
@schweitz @jeanPerier  Is this an acceptable change from heap.getType()?  I needed this in order to be able to trigger the error.


================
Comment at: flang/test/Fir/convert-to-llvm.fir:197
+// CHECK: [[NULL:%.*]]  = llvm.mlir.null : !llvm.ptr<array<100 x f32>> 
+// CHECK: [[ONE:%.*]]  = llvm.mlir.constant(1 : i64) : i64 
+// CHECK: [[PTR:%.*]]  = llvm.getelementptr [[NULL]][{{.*}}] : (!llvm.ptr<array<100 x f32>>, i64) -> !llvm.ptr<array<100 x f32>> 
----------------
awarzynski wrote:
> What's `ONE` for? If it's not used then perhaps it should not be generated?
Oops!  That was leftover from a previous version of the test.  It's not needed now, so I'll remove it.  Thanks for the catch!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114104/new/

https://reviews.llvm.org/D114104



More information about the flang-commits mailing list