[PATCH] D79296: [mlir][DenseElementsAttr] Add support for opaque APFloat/APInt complex values.

Kiran Chandramohan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 14 16:00:13 PDT 2020


kiranchandramohan added inline comments.
Herald added subscribers: msifontes, jurahul, stephenneuendorffer.
Herald added a project: MLIR.


================
Comment at: mlir/lib/IR/AsmPrinter.cpp:1548-1558
+    auto printComplexValue = [&](auto complexValues, auto printFn,
+                                 raw_ostream &os, auto &&... params) {
+      printDenseElementsAttrImpl(attr.isSplat(), type, os, [&](unsigned index) {
+        auto complexValue = *(complexValues.begin() + index);
+        os << "(";
+        printFn(complexValue.real(), os, params...);
+        os << ",";
----------------
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...);
      |                                          ^~~~~~
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79296/new/

https://reviews.llvm.org/D79296





More information about the llvm-commits mailing list