@@ -731,8 +731,9 @@ mlir::Value CirAttrToValue::visitCirAttr(cir::GlobalViewAttr globalAttr) {
731731 }
732732 auto resTy = addrOp.getType ();
733733 auto eltTy = converter->convertType (sourceType);
734- addrOp = rewriter.create <mlir::LLVM::GEPOp>(loc, resTy, eltTy, addrOp,
735- indices, mlir::LLVM::GEPNoWrapFlags::inbounds);
734+ addrOp = rewriter.create <mlir::LLVM::GEPOp>(
735+ loc, resTy, eltTy, addrOp, indices,
736+ mlir::LLVM::GEPNoWrapFlags::inbounds);
736737 }
737738
738739 if (auto intTy = mlir::dyn_cast<cir::IntType>(globalAttr.getType ())) {
@@ -1205,8 +1206,9 @@ mlir::LogicalResult CIRToLLVMVTTAddrPointOpLowering::matchAndRewrite(
12051206 offsets.push_back (0 );
12061207 offsets.push_back (adaptor.getOffset ());
12071208 }
1208- rewriter.replaceOpWithNewOp <mlir::LLVM::GEPOp>(op, resultType, eltType,
1209- llvmAddr, offsets, mlir::LLVM::GEPNoWrapFlags::inbounds);
1209+ rewriter.replaceOpWithNewOp <mlir::LLVM::GEPOp>(
1210+ op, resultType, eltType, llvmAddr, offsets,
1211+ mlir::LLVM::GEPNoWrapFlags::inbounds);
12101212 return mlir::success ();
12111213}
12121214
@@ -1903,9 +1905,18 @@ mlir::LogicalResult CIRToLLVMConstantOpLowering::matchAndRewrite(
19031905 typeConverter->convertType (op.getType ()),
19041906 mlir::cast<cir::FPAttr>(op.getValue ()).getValue ());
19051907 } else if (auto complexTy = mlir::dyn_cast<cir::ComplexType>(op.getType ())) {
1908+ mlir::Type complexElemTy = complexTy.getElementType ();
1909+ mlir::Type complexElemLLVMTy = typeConverter->convertType (complexElemTy);
1910+
1911+ if (auto zeroInitAttr = mlir::dyn_cast<cir::ZeroAttr>(op.getValue ())) {
1912+ mlir::TypedAttr zeroAttr = rewriter.getZeroAttr (complexElemLLVMTy);
1913+ mlir::ArrayAttr array = rewriter.getArrayAttr ({zeroAttr, zeroAttr});
1914+ rewriter.replaceOpWithNewOp <mlir::LLVM::ConstantOp>(
1915+ op, getTypeConverter ()->convertType (op.getType ()), array);
1916+ return mlir::success ();
1917+ }
1918+
19061919 auto complexAttr = mlir::cast<cir::ComplexAttr>(op.getValue ());
1907- auto complexElemTy = complexTy.getElementType ();
1908- auto complexElemLLVMTy = typeConverter->convertType (complexElemTy);
19091920
19101921 mlir::Attribute components[2 ];
19111922 if (mlir::isa<cir::IntType>(complexElemTy)) {
@@ -3881,8 +3892,9 @@ mlir::LogicalResult CIRToLLVMVTableAddrPointOpLowering::matchAndRewrite(
38813892 op.getAddressPointAttr ().getOffset ()};
38823893
38833894 assert (eltType && " Shouldn't ever be missing an eltType here" );
3884- rewriter.replaceOpWithNewOp <mlir::LLVM::GEPOp>(op, targetType, eltType,
3885- symAddr, offsets, mlir::LLVM::GEPNoWrapFlags::inbounds);
3895+ rewriter.replaceOpWithNewOp <mlir::LLVM::GEPOp>(
3896+ op, targetType, eltType, symAddr, offsets,
3897+ mlir::LLVM::GEPNoWrapFlags::inbounds);
38863898
38873899 return mlir::success ();
38883900}
@@ -3908,7 +3920,8 @@ mlir::LogicalResult CIRToLLVMVTableGetVirtualFnAddrOpLowering::matchAndRewrite(
39083920 llvm::SmallVector<mlir::LLVM::GEPArg> offsets =
39093921 llvm::SmallVector<mlir::LLVM::GEPArg>{op.getIndex ()};
39103922 rewriter.replaceOpWithNewOp <mlir::LLVM::GEPOp>(
3911- op, targetType, eltType, adaptor.getVptr (), offsets, mlir::LLVM::GEPNoWrapFlags::inbounds);
3923+ op, targetType, eltType, adaptor.getVptr (), offsets,
3924+ mlir::LLVM::GEPNoWrapFlags::inbounds);
39123925 return mlir::success ();
39133926}
39143927
@@ -4000,7 +4013,9 @@ mlir::LogicalResult CIRToLLVMInlineAsmOpLowering::matchAndRewrite(
40004013 op, llResTy, llvmOperands, op.getAsmStringAttr (), op.getConstraintsAttr (),
40014014 op.getSideEffectsAttr (),
40024015 /* is_align_stack*/ mlir::UnitAttr (),
4003- /* tail_call_kind*/ mlir::LLVM::TailCallKindAttr::get (getContext (), mlir::LLVM::tailcallkind::TailCallKind::None),
4016+ /* tail_call_kind*/
4017+ mlir::LLVM::TailCallKindAttr::get (
4018+ getContext (), mlir::LLVM::tailcallkind::TailCallKind::None),
40044019 mlir::LLVM::AsmDialectAttr::get (getContext (), llDialect),
40054020 rewriter.getArrayAttr (opAttrs));
40064021
0 commit comments