[PATCH] D119828: [flang][nfc] Update D119555 comments and use getVoidPtr

Jean Perier via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 15 04:04:59 PST 2022


jeanPerier created this revision.
jeanPerier added reviewers: clementval, schweitz.
jeanPerier added a project: Flang.
Herald added subscribers: mehdi_amini, jdoerfert.
Herald added a reviewer: sscalpone.
jeanPerier requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Minor comment updates and use getVoidPtr helper instead of
builiding `i8*` type manually in codegen.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119828

Files:
  flang/include/flang/Optimizer/Support/InternalNames.h
  flang/include/flang/Semantics/runtime-type-info.h
  flang/lib/Optimizer/CodeGen/CodeGen.cpp


Index: flang/lib/Optimizer/CodeGen/CodeGen.cpp
===================================================================
--- flang/lib/Optimizer/CodeGen/CodeGen.cpp
+++ flang/lib/Optimizer/CodeGen/CodeGen.cpp
@@ -1667,18 +1667,18 @@
       return rewriter.create<mlir::LLVM::AddressOfOp>(loc, ty,
                                                       global.getSymName());
     }
-    auto i8Ty = rewriter.getIntegerType(8);
     if (fir::NameUniquer::belongsToModule(
             name, Fortran::semantics::typeInfoBuiltinModule)) {
       // Type info derived types do not have type descriptors since they are the
       // types defining type descriptors.
-      auto i8PtrTy = mlir::LLVM::LLVMPointerType::get(i8Ty);
-      return rewriter.create<mlir::LLVM::NullOp>(loc, i8PtrTy);
+      return rewriter.create<mlir::LLVM::NullOp>(
+          loc, ::getVoidPtrType(box.getContext()));
     }
     // The global does not exist in the current translation unit, but may be
     // defined elsewhere (e.g., type defined in a module).
     // Create an available_externally global to require the symbols to be
     // defined elsewhere and to cause link-time failure otherwise.
+    auto i8Ty = rewriter.getIntegerType(8);
     mlir::OpBuilder modBuilder(module.getBodyRegion());
     modBuilder.create<mlir::LLVM::GlobalOp>(
         loc, i8Ty, /*isConstant=*/true,
Index: flang/include/flang/Semantics/runtime-type-info.h
===================================================================
--- flang/include/flang/Semantics/runtime-type-info.h
+++ flang/include/flang/Semantics/runtime-type-info.h
@@ -33,8 +33,8 @@
 
 RuntimeDerivedTypeTables BuildRuntimeDerivedTypeTables(SemanticsContext &);
 
-// Name of the builtin module that defines builtin derived types meant
-// to describe other derived types at runtime in flang descriptor.
+/// Name of the builtin module that defines builtin derived types meant
+/// to describe other derived types at runtime in flang descriptor.
 constexpr char typeInfoBuiltinModule[]{"__fortran_type_info"};
 
 } // namespace Fortran::semantics
Index: flang/include/flang/Optimizer/Support/InternalNames.h
===================================================================
--- flang/include/flang/Optimizer/Support/InternalNames.h
+++ flang/include/flang/Optimizer/Support/InternalNames.h
@@ -133,7 +133,7 @@
   /// Check whether the name should be re-mangle with external ABI convention.
   static bool needExternalNameMangling(llvm::StringRef uniquedName);
 
-  /// Does \p uniquedName belong to module \p moduleName ?
+  /// Does \p uniquedName belong to module \p moduleName?
   static bool belongsToModule(llvm::StringRef uniquedName,
                               llvm::StringRef moduleName);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119828.408809.patch
Type: text/x-patch
Size: 2735 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220215/7ecf40d8/attachment.bin>


More information about the llvm-commits mailing list