This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Add getArgOperandsMutable method to CallOpInterface
ClosedPublic

Authored by maerhart on Jul 31 2023, 4:55 AM.

Details

Summary

Add a method to the CallOpInterface to get a mutable operand range over
the function arguments. This allows to add, remove, or change the type
of call arguments in a generic manner without having to assume that the
argument operand range is at the end of the operand list, or having to
type switch on all supported concrete operation kinds.

Alternatively, a new OpInterface could be added which inherits from
CallOpInterface and appends it with the mutable variants of the base
interface.

There will be two users of this new function in the beginning:
(1) A few passes in the Arc dialect in CIRCT already use a downstream
implementation of the alternative case mentioned above: https://github.com/llvm/circt/blob/main/include/circt/Dialect/Arc/ArcInterfaces.td#L15
(2) The BufferDeallocation pass will be modified to be able to pass
ownership of memrefs to called private functions if the caller does not
need the memref anymore by appending the function argument list with a
boolean value per memref, thus enabling earlier deallocation of the
memref which can lead to lower peak memory usage.

Diff Detail

Event Timeline

maerhart created this revision.Jul 31 2023, 4:55 AM
Herald added a reviewer: ftynse. · View Herald Transcript
Herald added a reviewer: dcaballe. · View Herald Transcript
Herald added a reviewer: kuhar. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
maerhart requested review of this revision.Jul 31 2023, 4:55 AM
ftynse accepted this revision.Jul 31 2023, 9:05 AM
This revision is now accepted and ready to land.Jul 31 2023, 9:05 AM
maerhart updated this revision to Diff 546099.Aug 1 2023, 9:44 AM

Fix flang build

Herald added a project: Restricted Project. · View Herald TranscriptAug 1 2023, 9:44 AM