Skip to content

[mlir] OptionalProp<IntProp<uint8_t>> printout empty for 0 and similar values. #144993

Closed
@peledins-zimperium

Description

@peledins-zimperium

We have in our op:

arguments = (ins OptionalProp<IntProp<"uint8_t">>:$stuff)
...
let assemblyFormat = [{
        $op (`stuff` $stuff^)?
    }];

When serializing this for stuff==0 we get printout of

stuff

In generated code:
_odsPrinter << (*(getProperties().stuff));
which maps to:

  raw_ostream &operator<<(unsigned char C) {
    if (OutBufCur >= OutBufEnd)
      return write(C);
    *OutBufCur++ = C;
    return *this;
  }

So it ends up printing \0 instead of 0.

uint16_t works, int8_t does not.

For OptionalAttr<I8Attr> this works as expected and prints 0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions