This revision allows for creating DenseElementsAttrs and accessing elements using std::complex<APInt>/std::complex<APFloat>. This allows for opaquely accessing and transforming complex values. This is used by the printer/parser to provide pretty printing for complex values. The form for complex values matches that of std::complex, i.e.:
// `(` element `,` element `)` dense<(10,10)> : tensor<complex<i64>>
Depends On D79281
The code here hits a g++ bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90538) in gcc-9.1/gcc-9.2. This seems to be fixed in 9.3. Will you accept a workaround for this?
/home/user02/open_source/llvm-project/mlir/lib/IR/AsmPrinter.cpp: In instantiation of ‘{anonymous}::ModulePrinter::printDenseIntOrFPElementsAttr(mlir::DenseIntOrFPElementsAttr, bool)::<lambda(auto:2, auto:3, llvm::raw_ostream&, auto:4&& ...)> [with auto:2 = llvm::iterator_range<mlir::DenseElementsAttr::ComplexIntElementIterator>; auto:3 = void (*)(const llvm::APInt&, llvm::raw_ostream&, bool); auto:4 = {bool}]’: /home/user02/open_source/llvm-project/mlir/lib/IR/AsmPrinter.cpp:1565:77: required from here /home/user02/open_source/llvm-project/mlir/lib/IR/AsmPrinter.cpp:1557:42: error: redeclaration of ‘bool& params#0’ 1557 | printFn(complexValue.imag(), os, params...); | ^~~~~~ /home/user02/open_source/llvm-project/mlir/lib/IR/AsmPrinter.cpp:1555:42: note: ‘bool& params#0’ previously declared here 1555 | printFn(complexValue.real(), os, params...); | ^~~~~~