diff --git a/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp b/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp --- a/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp +++ b/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp @@ -1385,7 +1385,7 @@ }; struct BinaryComplexOperands { - Value lhsReal, lhsImag, rhsReal, rhsImag; + std::complex lhs, rhs; }; template @@ -1399,11 +1399,11 @@ // Extract real and imaginary values from operands. BinaryComplexOperands unpacked; ComplexStructBuilder lhs(transformed.lhs()); - unpacked.lhsReal = lhs.real(rewriter, loc); - unpacked.lhsImag = lhs.imaginary(rewriter, loc); + unpacked.lhs.real(lhs.real(rewriter, loc)); + unpacked.lhs.imag(lhs.imaginary(rewriter, loc)); ComplexStructBuilder rhs(transformed.rhs()); - unpacked.rhsReal = rhs.real(rewriter, loc); - unpacked.rhsImag = rhs.imaginary(rewriter, loc); + unpacked.rhs.real(rhs.real(rewriter, loc)); + unpacked.rhs.imag(rhs.imaginary(rewriter, loc)); return unpacked; } @@ -1424,8 +1424,10 @@ auto result = ComplexStructBuilder::undef(rewriter, loc, structType); // Emit IR to add complex numbers. - Value real = rewriter.create(loc, arg.lhsReal, arg.rhsReal); - Value imag = rewriter.create(loc, arg.lhsImag, arg.rhsImag); + Value real = + rewriter.create(loc, arg.lhs.real(), arg.rhs.real()); + Value imag = + rewriter.create(loc, arg.lhs.imag(), arg.rhs.imag()); result.setReal(rewriter, loc, real); result.setImaginary(rewriter, loc, imag); @@ -1450,8 +1452,10 @@ auto result = ComplexStructBuilder::undef(rewriter, loc, structType); // Emit IR to substract complex numbers. - Value real = rewriter.create(loc, arg.lhsReal, arg.rhsReal); - Value imag = rewriter.create(loc, arg.lhsImag, arg.rhsImag); + Value real = + rewriter.create(loc, arg.lhs.real(), arg.rhs.real()); + Value imag = + rewriter.create(loc, arg.lhs.imag(), arg.rhs.imag()); result.setReal(rewriter, loc, real); result.setImaginary(rewriter, loc, imag);