Skip to content

Commit 67e6ac3

Browse files
committed
[CIR] Remove duplicated annotation definition
1 parent 4f39afe commit 67e6ac3

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,6 +1610,10 @@ void LoweringPreparePass::runOnOperation() {
16101610
buildCXXGlobalInitFunc();
16111611
buildGlobalCtorDtorList();
16121612
buildGlobalAnnotationValues();
1613+
1614+
if (theModule && theModule->hasAttr("cir.global_annotations")) {
1615+
theModule->removeAttr("cir.global_annotations");
1616+
}
16131617
}
16141618

16151619
std::unique_ptr<Pass> mlir::createLoweringPreparePass() {

clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2190,6 +2190,11 @@ mlir::LogicalResult CIRToLLVMFuncOpLowering::matchAndRewrite(
21902190
cir::FuncOp op, OpAdaptor adaptor,
21912191
mlir::ConversionPatternRewriter &rewriter) const {
21922192

2193+
mlir::ModuleOp module = op->getParentOfType<mlir::ModuleOp>();
2194+
if (module->hasAttr("cir.global_annotations")) {
2195+
op->removeAttr("annotations");
2196+
}
2197+
21932198
auto fnType = op.getFunctionType();
21942199
auto isDsoLocal = op.getDsoLocal();
21952200
mlir::TypeConverter::SignatureConversion signatureConversion(

0 commit comments

Comments
 (0)