diff options
author | max <maksim.levental@gmail.com> | 2023-05-26 14:39:03 -0500 |
---|---|---|
committer | max <maksim.levental@gmail.com> | 2023-05-26 14:50:51 -0500 |
commit | e0ca7e99914609bbed0f30f4834a93d33dcef085 (patch) | |
tree | be2be97c9cb842381a902ed5b75d61fa5e704d21 /clang/lib/Lex/ModuleMap.cpp | |
parent | 69f16f75c66eb26ac49692558b4b4cbaad6a05c7 (diff) | |
download | llvm-e0ca7e99914609bbed0f30f4834a93d33dcef085.zip llvm-e0ca7e99914609bbed0f30f4834a93d33dcef085.tar.gz llvm-e0ca7e99914609bbed0f30f4834a93d33dcef085.tar.bz2 |
[MLIR][python bindings] Fix inferReturnTypes + AttrSizedOperandSegments for optional operands
Right now `inferTypeOpInterface.inferReturnTypes` fails because there's a cast in there to `py::sequence` which throws a `TypeError` when it tries to cast the `None`s. Note `None`s are inserted into `operands` for omitted operands passed to the generated builder:
```
operands.append(_get_op_result_or_value(start) if start is not None else None)
operands.append(_get_op_result_or_value(stop) if stop is not None else None)
operands.append(_get_op_result_or_value(step) if step is not None else None)
```
Note also that skipping appending to the list operands doesn't work either because [[ https://github.com/llvm/llvm-project/blob/27c37327da67020f938aabf0f6405f57d688441e/mlir/lib/Bindings/Python/IRCore.cpp#L1585 | build generic ]] checks against the number of operand segments expected.
Currently the only way around is to handroll through `ir.Operation.create`.
Reviewed By: rkayaith
Differential Revision: https://reviews.llvm.org/D151409
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
0 files changed, 0 insertions, 0 deletions