Skip to content

Commit ea00ca2

Browse files
committed
Address code review comments
1 parent 569c9fe commit ea00ca2

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
149149

150150
mlir::Value createComplexReal(mlir::Location loc, mlir::Value operand) {
151151
auto resultType = operand.getType();
152-
if (mlir::isa<cir::ComplexType>(resultType))
153-
resultType = mlir::cast<cir::ComplexType>(resultType).getElementType();
152+
if (auto complexResultType = mlir::dyn_cast<cir::ComplexType>(resultType))
153+
resultType = complexResultType.getElementType();
154154
return cir::ComplexRealOp::create(*this, loc, resultType, operand);
155155
}
156156

clang/include/clang/CIR/Dialect/IR/CIROps.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3260,8 +3260,8 @@ def CIR_ComplexCreateOp : CIR_Op<"complex.create", [Pure, SameTypeOperands]> {
32603260
def CIR_ComplexRealOp : CIR_Op<"complex.real", [Pure]> {
32613261
let summary = "Extract the real part of a complex value";
32623262
let description = [{
3263-
`cir.complex.real` operation takes an operand of `!cir.complex` or scalar
3264-
type and yields the real part of it.
3263+
`cir.complex.real` operation takes an operand of `!cir.complex`, `!cir.int`
3264+
or `!cir.float` type and yields the real part of it.
32653265

32663266
Example:
32673267

clang/lib/CIR/Dialect/IR/CIRDialect.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2389,8 +2389,8 @@ OpFoldResult cir::ComplexCreateOp::fold(FoldAdaptor adaptor) {
23892389

23902390
LogicalResult cir::ComplexRealOp::verify() {
23912391
mlir::Type operandTy = getOperand().getType();
2392-
if (mlir::isa<cir::ComplexType>(operandTy)) {
2393-
operandTy = mlir::cast<cir::ComplexType>(operandTy).getElementType();
2392+
if (auto complexOperandTy = mlir::dyn_cast<cir::ComplexType>(operandTy)) {
2393+
operandTy = complexOperandTy.getElementType();
23942394
}
23952395

23962396
if (getType() != operandTy) {

0 commit comments

Comments
 (0)