[flang-commits] [flang] [WIP] [flang] Always lower ALLOCATE/DEALLOCATE to runtime calls. (PR #133238)

Valentin Clement バレンタイン クレメン via flang-commits flang-commits at lists.llvm.org
Thu Mar 27 08:58:21 PDT 2025


================
@@ -470,21 +470,21 @@ class AllocateStmtHelper {
   void genSimpleAllocation(const Allocation &alloc,
                            const fir::MutableBoxValue &box) {
     bool isCudaSymbol = Fortran::semantics::HasCUDAAttr(alloc.getSymbol());
-    bool isCudaDeviceContext = cuf::isCUDADeviceContext(builder.getRegion());
-    bool inlineAllocation = !box.isDerived() && !errorManager.hasStatSpec() &&
-                            !alloc.type.IsPolymorphic() &&
-                            !alloc.hasCoarraySpec() && !useAllocateRuntime &&
-                            !box.isPointer();
+
     unsigned allocatorIdx = Fortran::lower::getAllocatorIdx(alloc.getSymbol());
 
-    if (inlineAllocation &&
-        ((isCudaSymbol && isCudaDeviceContext) || !isCudaSymbol)) {
-      // Pointers must use PointerAllocate so that their deallocations
-      // can be validated.
-      genInlinedAllocation(alloc, box);
-      postAllocationAction(alloc);
-      setPinnedToFalse();
-      return;
+    if (isCudaSymbol) {
----------------
clementval wrote:

Want want inline allocation for non cuda symbol as well. 

https://github.com/llvm/llvm-project/pull/133238


More information about the flang-commits mailing list