[PATCH] D78752: Add support for IndexType inside DenseIntElementsAttr.

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 23 15:16:55 PDT 2020


rriddle accepted this revision.
rriddle added inline comments.
This revision is now accepted and ready to land.


================
Comment at: mlir/lib/Parser/Parser.cpp:2047
   // with the correct bitwidth.
   if (auto intTy = type.getElementType().dyn_cast<IntegerType>())
     return getIntAttr(loc, type, intTy);
----------------
nit:

```
Type eltType = type.getElementType();
if (eltType.isIntOrIndex())
  ...

...
auto floatTy = eltType...
```


================
Comment at: mlir/lib/Parser/Parser.cpp:2092
             << "expected i1 type for 'true' or 'false' values";
-      APInt apInt(eltTy.getWidth(), token.is(Token::kw_true),
+      APInt apInt(eltTy.getIntOrFloatBitWidth(), token.is(Token::kw_true),
                   /*isSigned=*/false);
----------------
nit: Can you just replace this with 1?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78752





More information about the llvm-commits mailing list