Skip to content

Commit bc4826d

Browse files
committed
Apply review feedback
1 parent b4330a9 commit bc4826d

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
124124
cir::ConstantOp getTrue(mlir::Location loc) { return getBool(true, loc); }
125125

126126
cir::BoolType getBoolTy() { return cir::BoolType::get(getContext()); }
127+
cir::VoidType getVoidTy() { return cir::VoidType::get(getContext()); }
127128

128129
cir::PointerType getPointerTo(mlir::Type ty) {
129130
return cir::PointerType::get(ty);

clang/include/clang/CIR/Dialect/IR/CIRAttrs.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@
2020

2121
#include "clang/CIR/Interfaces/CIRTypeInterfaces.h"
2222

23-
namespace cir {
24-
inline constexpr uint32_t DefaultGlobalCtorDtorPriority = 65535;
25-
} // namespace cir
26-
2723
//===----------------------------------------------------------------------===//
2824
// CIR Dialect Attrs
2925
//===----------------------------------------------------------------------===//

clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -634,8 +634,7 @@ LoweringPreparePass::buildCXXGlobalVarDeclInitFunc(cir::GlobalOp op) {
634634
// Create a variable initialization function.
635635
CIRBaseBuilderTy builder(getContext());
636636
builder.setInsertionPointAfter(op);
637-
auto voidTy = cir::VoidType::get(builder.getContext());
638-
auto fnType = cir::FuncType::get({}, voidTy);
637+
auto fnType = cir::FuncType::get({}, builder.getVoidTy());
639638
FuncOp f = buildRuntimeFunction(builder, fnName, op.getLoc(), fnType,
640639
cir::GlobalLinkageKind::InternalLinkage);
641640

@@ -648,7 +647,7 @@ LoweringPreparePass::buildCXXGlobalVarDeclInitFunc(cir::GlobalOp op) {
648647
}
649648

650649
// Register the destructor call with __cxa_atexit
651-
auto &dtorRegion = op.getDtorRegion();
650+
mlir::Region &dtorRegion = op.getDtorRegion();
652651
if (!dtorRegion.empty()) {
653652
assert(!cir::MissingFeatures::opGlobalDtorLowering());
654653
llvm_unreachable("dtor region lowering is NYI");
@@ -666,7 +665,7 @@ LoweringPreparePass::buildCXXGlobalVarDeclInitFunc(cir::GlobalOp op) {
666665
}
667666

668667
assert(isa<YieldOp>(*yieldOp));
669-
builder.create<ReturnOp>(yieldOp->getLoc());
668+
cir::ReturnOp::create(builder, yieldOp->getLoc());
670669
return f;
671670
}
672671

@@ -716,16 +715,15 @@ void LoweringPreparePass::buildCXXGlobalInitFunc() {
716715

717716
CIRBaseBuilderTy builder(getContext());
718717
builder.setInsertionPointToEnd(&mlirModule.getBodyRegion().back());
719-
auto fnType =
720-
cir::FuncType::get({}, cir::VoidType::get(builder.getContext()));
718+
auto fnType = cir::FuncType::get({}, builder.getVoidTy());
721719
cir::FuncOp f =
722720
buildRuntimeFunction(builder, fnName, mlirModule.getLoc(), fnType,
723721
cir::GlobalLinkageKind::ExternalLinkage);
724722
builder.setInsertionPointToStart(f.addEntryBlock());
725723
for (cir::FuncOp &f : dynamicInitializers)
726724
builder.createCallOp(f.getLoc(), f, {});
727725

728-
builder.create<ReturnOp>(f.getLoc());
726+
cir::ReturnOp::create(builder, f.getLoc());
729727
}
730728

731729
static void lowerArrayDtorCtorIntoLoop(cir::CIRBaseBuilderTy &builder,

0 commit comments

Comments
 (0)