Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions clang/include/clang/CIR/Dialect/IR/CIRAttrs.td
Original file line number Diff line number Diff line change
Expand Up @@ -506,28 +506,40 @@ def CIR_FPAttr : CIR_Attr<"FP", "fp", [TypedAttrInterface]> {
}

//===----------------------------------------------------------------------===//
// ComplexAttr
// ConstComplexAttr
//===----------------------------------------------------------------------===//

def CIR_ComplexAttr : CIR_Attr<"Complex", "complex", [TypedAttrInterface]> {
def CIR_ComplexAttr : CIR_Attr<"ConstComplex", "const_complex", [
TypedAttrInterface
]> {
let summary = "An attribute that contains a constant complex value";
let description = [{
The `#cir.complex` attribute contains a constant value of complex number
type. The `real` parameter gives the real part of the complex number and the
`imag` parameter gives the imaginary part of the complex number.
The `#cir.const_complex` attribute contains a constant value of complex
number type. The `real` parameter gives the real part of the complex number
and the `imag` parameter gives the imaginary part of the complex number.

The `real` and `imag` parameter must be either an IntAttr or an FPAttr that
contains values of the same CIR type.
The `real` and `imag` parameters must both reference the same type and must
be either IntAttr or FPAttr.

Example:
```mlir
%ci = #cir.const_complex<#cir.int<1> : !s32i, #cir.int<2> : !s32i>
: !cir.complex<!s32i>
%cf = #cir.const_complex<#cir.fp<1.000000e+00> : !cir.float,
#cir.fp<2.000000e+00> : !cir.float> : !cir.complex<!cir.float>
```
}];

let parameters = (ins
AttributeSelfTypeParameter<"", "cir::ComplexType">:$type,
"mlir::TypedAttr":$real, "mlir::TypedAttr":$imag);
CIR_AnyIntOrFloatAttr:$real,
CIR_AnyIntOrFloatAttr:$imag
);

let builders = [
AttrBuilderWithInferredContext<(ins "cir::ComplexType":$type,
"mlir::TypedAttr":$real,
AttrBuilderWithInferredContext<(ins "mlir::TypedAttr":$real,
"mlir::TypedAttr":$imag), [{
auto type = cir::ComplexType::get(real.getType());
return $_get(type.getContext(), type, real, imag);
}]>,
];
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/CIR/LoweringHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ lowerConstVectorAttr(cir::ConstVectorAttr constArr,
const mlir::TypeConverter *converter);

std::optional<mlir::Attribute>
lowerConstComplexAttr(cir::ComplexAttr constArr,
lowerConstComplexAttr(cir::ConstComplexAttr constArr,
const mlir::TypeConverter *converter);

#endif
23 changes: 11 additions & 12 deletions clang/lib/CIR/CodeGen/CIRGenExprConst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2052,25 +2052,24 @@ mlir::Attribute ConstantEmitter::tryEmitPrivate(const APValue &Value,
case APValue::ComplexFloat:
case APValue::ComplexInt: {
mlir::Type desiredType = CGM.convertType(DestType);
cir::ComplexType complexType =
mlir::dyn_cast<cir::ComplexType>(desiredType);
auto complexType = mlir::dyn_cast<cir::ComplexType>(desiredType);

mlir::Type complexElemTy = complexType.getElementType();
if (isa<cir::IntType>(complexElemTy)) {
llvm::APSInt real = Value.getComplexIntReal();
llvm::APSInt imag = Value.getComplexIntImag();
return builder.getAttr<cir::ComplexAttr>(
complexType, cir::IntAttr::get(complexElemTy, real),
cir::IntAttr::get(complexElemTy, imag));
const llvm::APSInt &real = Value.getComplexIntReal();
const llvm::APSInt &imag = Value.getComplexIntImag();
return cir::ConstComplexAttr::get(builder.getContext(), complexType,
cir::IntAttr::get(complexElemTy, real),
cir::IntAttr::get(complexElemTy, imag));
Comment on lines +2061 to +2063
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for complexType here as we can infer it in builder?

}

assert(isa<cir::FPTypeInterface>(complexElemTy) &&
"expected floating-point type");
llvm::APFloat real = Value.getComplexFloatReal();
llvm::APFloat imag = Value.getComplexFloatImag();
return builder.getAttr<cir::ComplexAttr>(
complexType, cir::FPAttr::get(complexElemTy, real),
cir::FPAttr::get(complexElemTy, imag));
const llvm::APFloat &real = Value.getComplexFloatReal();
const llvm::APFloat &imag = Value.getComplexFloatImag();
return cir::ConstComplexAttr::get(builder.getContext(), complexType,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for complexType here as we can infer it in builder?

cir::FPAttr::get(complexElemTy, real),
cir::FPAttr::get(complexElemTy, imag));
}
case APValue::FixedPoint:
case APValue::AddrLabelDiff:
Expand Down
9 changes: 5 additions & 4 deletions clang/lib/CIR/Dialect/IR/CIRAttrs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,13 @@ LogicalResult FPAttr::verify(function_ref<InFlightDiagnostic()> emitError,
}

//===----------------------------------------------------------------------===//
// ComplexAttr definitions
// ConstComplexAttr definitions
//===----------------------------------------------------------------------===//

LogicalResult ComplexAttr::verify(function_ref<InFlightDiagnostic()> emitError,
cir::ComplexType type, mlir::TypedAttr real,
mlir::TypedAttr imag) {
LogicalResult
ConstComplexAttr::verify(function_ref<InFlightDiagnostic()> emitError,
cir::ComplexType type, mlir::TypedAttr real,
mlir::TypedAttr imag) {
auto elemType = type.getElementType();
if (real.getType() != elemType)
return emitError()
Expand Down
16 changes: 7 additions & 9 deletions clang/lib/CIR/Dialect/IR/CIRDialect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ static LogicalResult checkConstantTypes(mlir::Operation *op, mlir::Type opType,
return success();
}

if (mlir::isa<cir::IntAttr, cir::FPAttr, cir::ComplexAttr>(attrType)) {
if (mlir::isa<cir::IntAttr, cir::FPAttr, cir::ConstComplexAttr>(attrType)) {
auto at = cast<TypedAttr>(attrType);
if (at.getType() != opType) {
return op->emitOpError("result type (")
Expand Down Expand Up @@ -923,20 +923,16 @@ LogicalResult cir::ComplexCreateOp::verify() {
OpFoldResult cir::ComplexCreateOp::fold(FoldAdaptor adaptor) {
auto real = adaptor.getReal();
auto imag = adaptor.getImag();

if (!real || !imag)
return nullptr;

// When both of real and imag are constants, we can fold the operation into an
// `cir.const #cir.complex` operation.

// `cir.const #cir.const_complex` operation.
auto realAttr = mlir::cast<mlir::TypedAttr>(real);
auto imagAttr = mlir::cast<mlir::TypedAttr>(imag);
assert(realAttr.getType() == imagAttr.getType() &&
"real part and imag part should be of the same type");

auto complexTy = cir::ComplexType::get(realAttr.getType());
return cir::ComplexAttr::get(complexTy, realAttr, imagAttr);
return cir::ConstComplexAttr::get(realAttr, imagAttr);
}

//===----------------------------------------------------------------------===//
Expand All @@ -955,7 +951,8 @@ OpFoldResult cir::ComplexRealOp::fold(FoldAdaptor adaptor) {
if (auto complexCreateOp = getOperand().getDefiningOp<cir::ComplexCreateOp>())
return complexCreateOp.getOperand(0);

auto complex = mlir::cast_if_present<cir::ComplexAttr>(adaptor.getOperand());
auto complex =
mlir::cast_if_present<cir::ConstComplexAttr>(adaptor.getOperand());
return complex ? complex.getReal() : nullptr;
}

Expand All @@ -971,7 +968,8 @@ OpFoldResult cir::ComplexImagOp::fold(FoldAdaptor adaptor) {
if (auto complexCreateOp = getOperand().getDefiningOp<cir::ComplexCreateOp>())
return complexCreateOp.getOperand(1);

auto complex = mlir::cast_if_present<cir::ComplexAttr>(adaptor.getOperand());
auto complex =
mlir::cast_if_present<cir::ConstComplexAttr>(adaptor.getOperand());
return complex ? complex.getImag() : nullptr;
}

Expand Down
13 changes: 7 additions & 6 deletions clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,8 @@ class CirAttrToValue {
cir::ConstRecordAttr, cir::ConstArrayAttr, cir::ConstVectorAttr,
cir::BoolAttr, cir::ZeroAttr, cir::UndefAttr, cir::PoisonAttr,
cir::GlobalViewAttr, cir::VTableAttr, cir::TypeInfoAttr,
cir::ComplexAttr>([&](auto attrT) { return visitCirAttr(attrT); })
cir::ConstComplexAttr>(
[&](auto attrT) { return visitCirAttr(attrT); })
.Default([&](auto attrT) { return mlir::Value(); });
}

Expand All @@ -479,7 +480,7 @@ class CirAttrToValue {
mlir::Value visitCirAttr(cir::ConstRecordAttr attr);
mlir::Value visitCirAttr(cir::ConstArrayAttr attr);
mlir::Value visitCirAttr(cir::ConstVectorAttr attr);
mlir::Value visitCirAttr(cir::ComplexAttr attr);
mlir::Value visitCirAttr(cir::ConstComplexAttr attr);
mlir::Value visitCirAttr(cir::BoolAttr attr);
mlir::Value visitCirAttr(cir::ZeroAttr attr);
mlir::Value visitCirAttr(cir::UndefAttr attr);
Expand Down Expand Up @@ -671,7 +672,7 @@ mlir::Value CirAttrToValue::visitCirAttr(cir::ConstVectorAttr constVec) {
mlirValues));
}

mlir::Value CirAttrToValue::visitCirAttr(cir::ComplexAttr complexAttr) {
mlir::Value CirAttrToValue::visitCirAttr(cir::ConstComplexAttr complexAttr) {
auto complexType = mlir::cast<cir::ComplexType>(complexAttr.getType());
mlir::Type complexElemTy = complexType.getElementType();
mlir::Type complexElemLLVMTy = converter->convertType(complexElemTy);
Expand Down Expand Up @@ -1944,7 +1945,7 @@ mlir::LogicalResult CIRToLLVMConstantOpLowering::matchAndRewrite(
return mlir::success();
}

auto complexAttr = mlir::cast<cir::ComplexAttr>(op.getValue());
auto complexAttr = mlir::cast<cir::ConstComplexAttr>(op.getValue());

mlir::Attribute components[2];
if (mlir::isa<cir::IntType>(complexElemTy)) {
Expand Down Expand Up @@ -2620,7 +2621,7 @@ mlir::LogicalResult CIRToLLVMGlobalOpLowering::lowerInitializer(
} else if (mlir::isa<cir::ConstVectorAttr>(init)) {
return lowerInitializerForConstVector(rewriter, op, init,
useInitializerRegion);
} else if (mlir::isa<cir::ComplexAttr>(init)) {
} else if (mlir::isa<cir::ConstComplexAttr>(init)) {
return lowerInitializerForConstComplex(rewriter, op, init,
useInitializerRegion);
} else if (auto dataMemberAttr = mlir::dyn_cast<cir::DataMemberAttr>(init)) {
Expand Down Expand Up @@ -2662,7 +2663,7 @@ mlir::LogicalResult CIRToLLVMGlobalOpLowering::lowerInitializerForConstVector(
mlir::LogicalResult CIRToLLVMGlobalOpLowering::lowerInitializerForConstComplex(
mlir::ConversionPatternRewriter &rewriter, cir::GlobalOp op,
mlir::Attribute &init, bool &useInitializerRegion) const {
auto constVec = mlir::cast<cir::ComplexAttr>(init);
auto constVec = mlir::cast<cir::ConstComplexAttr>(init);
if (auto val = lowerConstComplexAttr(constVec, getTypeConverter());
val.has_value()) {
init = val.value();
Expand Down
8 changes: 4 additions & 4 deletions clang/lib/CIR/Lowering/LoweringHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void convertToDenseElementsAttrImpl(

template <typename AttrTy, typename StorageTy>
void convertToDenseElementsAttrImpl(
cir::ComplexAttr attr, llvm::SmallVectorImpl<StorageTy> &values,
cir::ConstComplexAttr attr, llvm::SmallVectorImpl<StorageTy> &values,
const llvm::SmallVectorImpl<int64_t> &currentDims, int64_t dimIndex,
int64_t currentIndex) {
dimIndex++;
Expand Down Expand Up @@ -187,7 +187,7 @@ mlir::DenseElementsAttr convertToDenseElementsAttr(

template <typename AttrTy, typename StorageTy>
mlir::DenseElementsAttr convertToDenseElementsAttr(
cir::ComplexAttr attr, const llvm::SmallVectorImpl<int64_t> &dims,
cir::ConstComplexAttr attr, const llvm::SmallVectorImpl<int64_t> &dims,
mlir::Type elementType, mlir::Type convertedElementType) {
unsigned array_size = 2;
auto values = llvm::SmallVector<StorageTy, 8>(
Expand Down Expand Up @@ -233,12 +233,12 @@ lowerConstArrayAttr(cir::ConstArrayAttr constArr,
}

std::optional<mlir::Attribute>
lowerConstComplexAttr(cir::ComplexAttr constComplex,
lowerConstComplexAttr(cir::ConstComplexAttr constComplex,
const mlir::TypeConverter *converter) {

// Ensure ComplexAttr has a type.
auto typedConstArr = mlir::dyn_cast<mlir::TypedAttr>(constComplex);
assert(typedConstArr && "cir::ComplexAttr is not a mlir::TypedAttr");
assert(typedConstArr && "cir::ConstComplexAttr is not a mlir::TypedAttr");

mlir::Type type = constComplex.getType();
auto dims = llvm::SmallVector<int64_t, 2>{2};
Expand Down
2 changes: 1 addition & 1 deletion clang/test/CIR/CodeGen/complex-init-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ void foo() {

// CIR: %[[INIT:.*]] = cir.alloca !cir.complex<!s32i>, !cir.ptr<!cir.complex<!s32i>>, ["c", init]
// CIR: %[[COMPOUND:.*]] = cir.alloca !cir.complex<!s32i>, !cir.ptr<!cir.complex<!s32i>>, [".compoundliteral", init]
// CIR: %[[COMPLEX:.*]] = cir.const #cir.complex<#cir.int<1> : !s32i, #cir.int<2> : !s32i> : !cir.complex<!s32i>
// CIR: %[[COMPLEX:.*]] = cir.const #cir.const_complex<#cir.int<1> : !s32i, #cir.int<2> : !s32i> : !cir.complex<!s32i>
// CIR: cir.store{{.*}} %[[COMPLEX]], %[[COMPOUND]] : !cir.complex<!s32i>, !cir.ptr<!cir.complex<!s32i>>
// CIR: %[[TMP:.*]] = cir.load{{.*}} %[[COMPOUND]] : !cir.ptr<!cir.complex<!s32i>>, !cir.complex<!s32i>
// CIR: cir.store{{.*}} %[[TMP]], %[[INIT]] : !cir.complex<!s32i>, !cir.ptr<!cir.complex<!s32i>>
Expand Down
10 changes: 5 additions & 5 deletions clang/test/CIR/CodeGen/complex.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ void list_init() {
// CHECK-BEFORE: }

// CHECK-AFTER: cir.func
// CHECK-AFTER: %{{.+}} = cir.const #cir.complex<#cir.fp<1.000000e+00> : !cir.double, #cir.fp<2.000000e+00> : !cir.double> : !cir.complex<!cir.double>
// CHECK-AFTER: %{{.+}} = cir.const #cir.complex<#cir.int<1> : !s32i, #cir.int<2> : !s32i> : !cir.complex<!s32i>
// CHECK-AFTER: %{{.+}} = cir.const #cir.const_complex<#cir.fp<1.000000e+00> : !cir.double, #cir.fp<2.000000e+00> : !cir.double> : !cir.complex<!cir.double>
// CHECK-AFTER: %{{.+}} = cir.const #cir.const_complex<#cir.int<1> : !s32i, #cir.int<2> : !s32i> : !cir.complex<!s32i>
// CHECK-AFTER: }

// LLVM: define dso_local void @list_init()
Expand Down Expand Up @@ -91,8 +91,8 @@ void imag_literal() {
// CHECK-BEFORE: }

// CHECK-AFTER: cir.func
// CHECK-AFTER: %{{.+}} = cir.const #cir.complex<#cir.fp<0.000000e+00> : !cir.double, #cir.fp<3.000000e+00> : !cir.double> : !cir.complex<!cir.double>
// CHECK-AFTER: %{{.+}} = cir.const #cir.complex<#cir.int<0> : !s32i, #cir.int<3> : !s32i> : !cir.complex<!s32i>
// CHECK-AFTER: %{{.+}} = cir.const #cir.const_complex<#cir.fp<0.000000e+00> : !cir.double, #cir.fp<3.000000e+00> : !cir.double> : !cir.complex<!cir.double>
// CHECK-AFTER: %{{.+}} = cir.const #cir.const_complex<#cir.int<0> : !s32i, #cir.int<3> : !s32i> : !cir.complex<!s32i>
// CHECK-AFTER: }

// LLVM: define dso_local void @imag_literal()
Expand Down Expand Up @@ -397,7 +397,7 @@ int extract_imag_and_add(int _Complex a, int _Complex b) {

void complex_with_empty_init() { int _Complex c = {}; }

// CHECK: {{.*}} = cir.const #cir.complex<#cir.int<0> : !s32i, #cir.int<0> : !s32i> : !cir.complex<!s32i>
// CHECK: {{.*}} = cir.const #cir.const_complex<#cir.int<0> : !s32i, #cir.int<0> : !s32i> : !cir.complex<!s32i>

void complex_array_subscript() {
int _Complex arr[2];
Expand Down
4 changes: 2 additions & 2 deletions clang/test/CIR/CodeGen/complex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ void complex_init_atomic() {
}

// CIR: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a"]
// CIR: %[[CONST_COMPLEX:.*]] = cir.const #cir.complex<#cir.fp<1.000000e+00> : !cir.float, #cir.fp<2.000000e+00> : !cir.float> : !cir.complex<!cir.float>
// CIR: %[[CONST_COMPLEX:.*]] = cir.const #cir.const_complex<#cir.fp<1.000000e+00> : !cir.float, #cir.fp<2.000000e+00> : !cir.float> : !cir.complex<!cir.float>
// CIR: cir.store{{.*}} %[[CONST_COMPLEX]], %[[A_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>

// LLVM: %[[A_ADDR:.*]] = alloca { float, float }, i64 1, align 8
Expand Down Expand Up @@ -350,7 +350,7 @@ void calling_function_with_default_arg() {
}

// CIR: %[[DEFAULT_ARG_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["coerce"]
// CIR: %[[DEFAULT_ARG_VAL:.*]] = cir.const #cir.complex<#cir.fp<1.000000e+00> : !cir.float, #cir.fp<2.200000e+00> : !cir.float> : !cir.complex<!cir.float>
// CIR: %[[DEFAULT_ARG_VAL:.*]] = cir.const #cir.const_complex<#cir.fp<1.000000e+00> : !cir.float, #cir.fp<2.200000e+00> : !cir.float> : !cir.complex<!cir.float>
// CIR: cir.store{{.*}} %[[DEFAULT_ARG_VAL]], %[[DEFAULT_ARG_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>
// CIR: %[[TMP_DEFAULT_ARG:.*]] = cir.load{{.*}} %[[DEFAULT_ARG_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float>
// CIR: cir.call @_Z33function_with_complex_default_argCf(%[[TMP_DEFAULT_ARG]]) : (!cir.complex<!cir.float>) -> ()
Expand Down
4 changes: 2 additions & 2 deletions clang/test/CIR/CodeGen/const-complex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ float _Complex gcf2 = { 1.0f, 2.0f };

// CHECK: cir.global external {{.*}} = #cir.zero : !cir.complex<!s32i>
// CHECK: cir.global external {{.*}} = #cir.zero : !cir.complex<!cir.float>
// CHECK: cir.global external {{.*}} = #cir.complex<#cir.int<1> : !s32i, #cir.int<2> : !s32i> : !cir.complex<!s32i>
// CHECK: cir.global external {{.*}} = #cir.complex<#cir.fp<1.000000e+00> : !cir.float, #cir.fp<2.000000e+00> : !cir.float> : !cir.complex<!cir.float>
// CHECK: cir.global external {{.*}} = #cir.const_complex<#cir.int<1> : !s32i, #cir.int<2> : !s32i> : !cir.complex<!s32i>
// CHECK: cir.global external {{.*}} = #cir.const_complex<#cir.fp<1.000000e+00> : !cir.float, #cir.fp<2.000000e+00> : !cir.float> : !cir.complex<!cir.float>

// LLVM: {{.*}} = global { i32, i32 } zeroinitializer, align 4
// LLVM: {{.*}} = global { float, float } zeroinitializer, align 4
Expand Down
2 changes: 1 addition & 1 deletion clang/test/CIR/CodeGen/new.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ void test_new_with_complex_type() {
// CHECK: %[[COMPLEX_SIZE:.*]] = cir.const #cir.int<8> : !u64i
// CHECK: %[[NEW_COMPLEX:.*]] = cir.call @_Znwm(%[[COMPLEX_SIZE]]) : (!u64i) -> !cir.ptr<!void>
// CHECK: %[[COMPLEX_PTR:.*]] = cir.cast bitcast %[[NEW_COMPLEX]] : !cir.ptr<!void> -> !cir.ptr<!cir.complex<!cir.float>>
// CHECK: %[[COMPLEX_VAL:.*]] = cir.const #cir.complex<#cir.fp<1.000000e+00> : !cir.float, #cir.fp<2.000000e+00> : !cir.float> : !cir.complex<!cir.float>
// CHECK: %[[COMPLEX_VAL:.*]] = cir.const #cir.const_complex<#cir.fp<1.000000e+00> : !cir.float, #cir.fp<2.000000e+00> : !cir.float> : !cir.complex<!cir.float>
// CHECK: cir.store{{.*}} %[[COMPLEX_VAL]], %[[COMPLEX_PTR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>
// CHECK: cir.store{{.*}} %[[COMPLEX_PTR]], %[[A_ADDR]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.ptr<!cir.ptr<!cir.complex<!cir.float>>>

Expand Down
2 changes: 1 addition & 1 deletion clang/test/CIR/Lowering/complex.cir
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

module {
cir.func @complex_const() -> !cir.complex<!s32i> {
%0 = cir.const #cir.complex<#cir.int<1> : !s32i, #cir.int<2> : !s32i> : !cir.complex<!s32i>
%0 = cir.const #cir.const_complex<#cir.int<1> : !s32i, #cir.int<2> : !s32i> : !cir.complex<!s32i>
cir.return %0 : !cir.complex<!s32i>
}

Expand Down
2 changes: 1 addition & 1 deletion clang/test/CIR/Transforms/complex-fold.cir
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module {
}

// CHECK-LABEL: cir.func @complex_create_fold() -> !cir.complex<!s32i> {
// CHECK-NEXT: %[[#A:]] = cir.const #cir.complex<#cir.int<1> : !s32i, #cir.int<2> : !s32i> : !cir.complex<!s32i>
// CHECK-NEXT: %[[#A:]] = cir.const #cir.const_complex<#cir.int<1> : !s32i, #cir.int<2> : !s32i> : !cir.complex<!s32i>
// CHECK-NEXT: cir.return %[[#A]] : !cir.complex<!s32i>
// CHECK-NEXT: }

Expand Down
Loading