This is an archive of the discontinued LLVM Phabricator instance.

[mlir][llvm] Add branch weights to call and invoke
ClosedPublic

Authored by Dinistro on Jan 6 2023, 4:07 AM.

Details

Summary

This commit introduces branch weight attributes to the LLVM::CallOp and
LLVM::InvokeOp and adds both import and export of them.

Diff Detail

Event Timeline

Dinistro created this revision.Jan 6 2023, 4:07 AM
Herald added a project: Restricted Project. · View Herald Transcript
Dinistro requested review of this revision.Jan 6 2023, 4:07 AM
gysit added inline comments.Jan 6 2023, 5:07 AM
mlir/lib/Target/LLVMIR/Dialect/LLVMIR/LLVMIRToLLVMTranslation.cpp
120–127

nit: do we want to use a TypeSwitch now that the list of operation starts to get long?

mlir/lib/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.cpp
326

nit: add a brief doc comment

330

nit: I believe the llvm prefix is not needed for SmallVector and APInt?

354–357

I think "If the called function has a result, remap the corresponding value. Note that LLVM IR dialect CallOp has either 0 or 1 result." should move down to where it was before?

if (opInst.getNumResults() != 0) {
  moduleTranslation.mapValue(opInst.getResult(0), call);
  return success();
}
mlir/test/Target/LLVMIR/llvmir.mlir
1638

nit: indent by 2 spaces.

1653

nit: indent by 2 spaces.

Dinistro updated this revision to Diff 486844.Jan 6 2023, 6:01 AM
Dinistro marked 4 inline comments as done.

address review comments

Dinistro marked 2 inline comments as done.Jan 6 2023, 6:01 AM
gysit accepted this revision.Jan 6 2023, 6:13 AM

LGTM!

This revision is now accepted and ready to land.Jan 6 2023, 6:13 AM
This revision was automatically updated to reflect the committed changes.