This is an archive of the discontinued LLVM Phabricator instance.

[mlir][TableGen] Support intrinsics with multiple returns and overloaded operands.
ClosedPublic

Authored by jikimjikim on Nov 17 2020, 9:52 PM.

Details

Summary

For intrinsics with multiple returns where one or more operands are overloaded, the overloaded type is inferred from the corresponding field of the resulting struct, instead of accessing the result directly.

As such, the hasResult parameter of LLVM_IntrOpBase (and derived classes) is replaced with numResults. TableGen for intrinsics also updated to populate this field with the total number of results.

Diff Detail

Event Timeline

jikimjikim created this revision.Nov 17 2020, 9:52 PM
Herald added a project: Restricted Project. · View Herald Transcript
jikimjikim requested review of this revision.Nov 17 2020, 9:52 PM

This broke some tests.

It would be nice to also add one intrinsic that needs this functionality in order to exercise the code path, add.with.overflow looks useful enough to have.

mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
229

Nit: MLIR uses camelBack

253

I think this should be !gt(numResults, 1)

ftynse requested changes to this revision.Nov 18 2020, 3:32 AM
This revision now requires changes to proceed.Nov 18 2020, 3:32 AM

Fix comparison to numResults, only use new pattern if >1.

Use camel case for new pattern name.

Add intrinsic tests for integer overflow arithmetic ops.

Also fix incorrect overloaded result index.

ftynse accepted this revision.Nov 19 2020, 12:52 AM

Thanks for fixing and iterating!

This revision is now accepted and ready to land.Nov 19 2020, 12:52 AM