Skip to content

Commit

Permalink
[flang][nfc] Update D119555 comments and use getVoidPtr
Browse files Browse the repository at this point in the history
Minor comment updates and use getVoidPtr helper instead of
builiding `i8*` type manually in codegen.

Differential Revision: https://reviews.llvm.org/D119828
  • Loading branch information
jeanPerier committed Feb 15, 2022
1 parent acc55ad commit 5bde97b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion flang/include/flang/Optimizer/Support/InternalNames.h
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions flang/include/flang/Semantics/runtime-type-info.h
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions flang/lib/Optimizer/CodeGen/CodeGen.cpp
Expand Up @@ -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,
Expand Down

0 comments on commit 5bde97b

Please sign in to comment.