[flang-commits] [flang] 85af192 - [flang][debug] Support mlir::NoneType. (#113550)

via flang-commits flang-commits at lists.llvm.org
Fri Oct 25 03:43:29 PDT 2024


Author: Abid Qadeer
Date: 2024-10-25T11:43:25+01:00
New Revision: 85af1926f74e88e14c9f58946537e025a74ccf7e

URL: https://github.com/llvm/llvm-project/commit/85af1926f74e88e14c9f58946537e025a74ccf7e
DIFF: https://github.com/llvm/llvm-project/commit/85af1926f74e88e14c9f58946537e025a74ccf7e.diff

LOG: [flang][debug] Support mlir::NoneType. (#113550)

Added: 
    flang/test/Transforms/debug-none-type.fir

Modified: 
    flang/lib/Optimizer/Transforms/DebugTypeGenerator.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Optimizer/Transforms/DebugTypeGenerator.cpp b/flang/lib/Optimizer/Transforms/DebugTypeGenerator.cpp
index 1ab6c76dae8eda..e387e27533a006 100644
--- a/flang/lib/Optimizer/Transforms/DebugTypeGenerator.cpp
+++ b/flang/lib/Optimizer/Transforms/DebugTypeGenerator.cpp
@@ -581,6 +581,8 @@ DebugTypeGenerator::convertType(mlir::Type Ty, mlir::LLVM::DIFileAttr fileAttr,
                                   /*genAssociated=*/false);
   } else if (auto vecTy = mlir::dyn_cast_or_null<fir::VectorType>(Ty)) {
     return convertVectorType(vecTy, fileAttr, scope, declOp);
+  } else if (mlir::isa<mlir::NoneType>(Ty)) {
+    return mlir::LLVM::DINullTypeAttr::get(context);
   } else if (auto boxTy = mlir::dyn_cast_or_null<fir::BoxType>(Ty)) {
     auto elTy = boxTy.getElementType();
     if (auto seqTy = mlir::dyn_cast_or_null<fir::SequenceType>(elTy))

diff  --git a/flang/test/Transforms/debug-none-type.fir b/flang/test/Transforms/debug-none-type.fir
new file mode 100644
index 00000000000000..5eee6a63321904
--- /dev/null
+++ b/flang/test/Transforms/debug-none-type.fir
@@ -0,0 +1,14 @@
+// RUN: fir-opt --add-debug-info --mlir-print-debuginfo %s | FileCheck %s
+
+module attributes {dlti.dl_spec = #dlti.dl_spec<>} {
+  func.func private @_FortranAAssign(i8) -> none loc(#loc1)
+  func.func private @foo() -> !fir.ref<none>  loc(#loc2)
+}
+#loc1 = loc("test.f90":5:1)
+#loc2 = loc("test.f90":15:1)
+
+// CHECK: #[[INT8_TY:.*]] = #llvm.di_basic_type<tag = DW_TAG_base_type, name = "integer", sizeInBits = 8, encoding = DW_ATE_signed>
+// CHECK: #[[NONE_TY:.*]] = #llvm.di_null_type
+// CHECK: #[[REFNONE_TY:.*]] = #llvm.di_derived_type<tag = DW_TAG_pointer_type, name = "", baseType = #di_null_type{{.*}}>
+// CHECK: #llvm.di_subroutine_type<{{.*}}types = #[[NONE_TY]], #[[INT8_TY]]>
+// CHECK: #llvm.di_subroutine_type<{{.*}}types = #[[REFNONE_TY]]>


        


More information about the flang-commits mailing list