[flang-commits] [flang] 5bde97b - [flang][nfc] Update D119555 comments and use getVoidPtr

Jean Perier via flang-commits flang-commits at lists.llvm.org
Tue Feb 15 09:29:33 PST 2022


Author: Jean Perier
Date: 2022-02-15T18:24:04+01:00
New Revision: 5bde97b17e751c32aae867ca1035fa146aed9221

URL: https://github.com/llvm/llvm-project/commit/5bde97b17e751c32aae867ca1035fa146aed9221
DIFF: https://github.com/llvm/llvm-project/commit/5bde97b17e751c32aae867ca1035fa146aed9221.diff

LOG: [flang][nfc] Update D119555 comments and use getVoidPtr

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

Differential Revision: https://reviews.llvm.org/D119828

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/flang/include/flang/Optimizer/Support/InternalNames.h b/flang/include/flang/Optimizer/Support/InternalNames.h
index 1f5e5552d50d..a9fbfc13cfcc 100644
--- a/flang/include/flang/Optimizer/Support/InternalNames.h
+++ b/flang/include/flang/Optimizer/Support/InternalNames.h
@@ -133,7 +133,7 @@ struct NameUniquer {
   /// 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);
 

diff  --git a/flang/include/flang/Semantics/runtime-type-info.h b/flang/include/flang/Semantics/runtime-type-info.h
index bc9ab58c02da..fad41d63e2da 100644
--- a/flang/include/flang/Semantics/runtime-type-info.h
+++ b/flang/include/flang/Semantics/runtime-type-info.h
@@ -33,8 +33,8 @@ struct RuntimeDerivedTypeTables {
 
 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

diff  --git a/flang/lib/Optimizer/CodeGen/CodeGen.cpp b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
index fc32ea633e41..51ba5263063a 100644
--- a/flang/lib/Optimizer/CodeGen/CodeGen.cpp
+++ b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
@@ -1667,18 +1667,18 @@ struct EmboxCommonConversion : public FIROpConversion<OP> {
       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,


        


More information about the flang-commits mailing list