This is an archive of the discontinued LLVM Phabricator instance.

[mlir][llvm] Add branch weight op interface
ClosedPublic

Authored by gysit on Jul 19 2023, 6:52 AM.

Details

Summary

This revision adds a branch weight op interface for the call / branch
operations that support branch weights. It can be used in the LLVM IR
import and export to simplify the branch weight conversion. An
additional mapping between call operations and instructions ensures
the actual conversion can be done in the module translation itself,
rather than in the dialect translation interface. It also has the
benefit that downstream users can amend custom metadata to the call
operation during the export to LLVM IR.

Diff Detail

Event Timeline

gysit created this revision.Jul 19 2023, 6:52 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
gysit requested review of this revision.Jul 19 2023, 6:52 AM
zero9178 accepted this revision.Jul 19 2023, 11:17 AM

LGTM % nits

mlir/include/mlir/Dialect/LLVMIR/LLVMInterfaces.td
69

I know this hasn't been done consistently in this file but you could use auto here and below to avoid repeating the type twice.

mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h
122
This revision is now accepted and ready to land.Jul 19 2023, 11:17 AM
gysit updated this revision to Diff 542332.Jul 20 2023, 12:15 AM
gysit marked 2 inline comments as done.

Address comments.

This revision was automatically updated to reflect the committed changes.