Closed roro47 closed 3 weeks ago
@bcardosolopes Currently when running ninja check-clang-cir
, 8 test cases are failing from the new changes because of
'cir.call' op requires attribute
extra_attrs
This is because CallOp are created in other places outside of CIRGenCall.cpp
with cir::CIRGenBuilderTy.create<mlir::cir::CallOp>
which didn't handle passing extra_attrs
. I think the best way to fix this is to modify those calls so that they all use just the methods from CIRGenCall.cpp
.
It makes sense to only use methods in CIRGenCall.cpp
to create callop instead of directly calling cir::CIRGenBuilderTy.create<mlir::cir::CallOp>
. What do you think about this approach?
Thanks for your first PR, this is great!
This is because CallOp are created in other places outside of
CIRGenCall.cpp
withcir::CIRGenBuilderTy.create<mlir::cir::CallOp>
which didn't handle passingextra_attrs
. I think the best way to fix this is to modify those calls so that they all use just the methods fromCIRGenCall.cpp
.
Sounds like a good plan!
It makes sense to only use methods in
CIRGenCall.cpp
to create callop instead of directly callingcir::CIRGenBuilderTy.create<mlir::cir::CallOp>
. What do you think about this approach?
I always prefer to refactor common code and boil down to one place that actually does the final calls to builder.create<...CallOp..>
. But if it's too complex to tackle all existing ones, you can start incremental and only change existing helpers to pass down extra_attrs
, and in a later PR you do further refactoring.
Thanks for your first PR, this is great!
This is because CallOp are created in other places outside of
CIRGenCall.cpp
withcir::CIRGenBuilderTy.create<mlir::cir::CallOp>
which didn't handle passingextra_attrs
. I think the best way to fix this is to modify those calls so that they all use just the methods fromCIRGenCall.cpp
.Sounds like a good plan!
It makes sense to only use methods in
CIRGenCall.cpp
to create callop instead of directly callingcir::CIRGenBuilderTy.create<mlir::cir::CallOp>
. What do you think about this approach?I always prefer to refactor common code and boil down to one place that actually does the final calls to
builder.create<...CallOp..>
. But if it's too complex to tackle all existing ones, you can start incremental and only change existing helpers to pass downextra_attrs
, and in a later PR you do further refactoring.
I didn't see any extra helper that was calling create<milr::cir::CallOp>
so I added a new helper called createCallOp
to replace it.
Looks like there are some failing tests, possibly some refactoring went wrong. You can catch those locally by running ninja check-clang-cir
.
Some function attributes are also callsite attributes, for instance, nothrow. This means they are going to show up in both. We don't support that just yet, hence the PR.
CIR has an attribute
ExtraFuncAttr
that we current use as part ofFuncOp
, see CIROps.td. This attribute also needs to be added toCallOp
andTryCalOp
.Right now, In
CIRGenCall.cpp: AddAttributesFromFunctionProtoType
fills inFuncAttrs
, but doesn't use it for anything. We should use theFuncAttrs
result to populate constructing aExtraFuncAttr
and add it to the aforementioned call operations.