This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Support import llvm intrinsics.
ClosedPublic

Authored by jacquesguan on May 30 2022, 2:41 AM.

Details

Summary

This patch supports to convert the llvm intrinsic to the correspond op. It still leaves some intrinsics to be handle specially.

Diff Detail

Event Timeline

jacquesguan created this revision.May 30 2022, 2:41 AM
jacquesguan requested review of this revision.May 30 2022, 2:41 AM
ftynse requested changes to this revision.May 30 2022, 8:55 AM

Thanks!

mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
658

Please add documentation.

965
mlir/test/Target/LLVMIR/Import/intrinsic.ll
13

Do not pattern-match SSA value names, here and below. We don't actually care about names here so something like %{{.+}} should be sufficient.

464

Not: could we have the check line next to the line that is being translated?

This revision now requires changes to proceed.May 30 2022, 8:55 AM

Thanks for adding this support. I only have some minor comments.

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

I feel like "id" is a little ambiguous, what about "llvmEnumName"?

mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
968

I think it's better to spell out auto on this line.

1167

ditto

mlir/test/Target/LLVMIR/Import/intrinsic.ll
4

Are you intend to add CHECK-s for this function as well?

address comment.

jacquesguan marked 6 inline comments as done.May 30 2022, 8:42 PM
jacquesguan added inline comments.
mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
658

Done.

965

Done.

968

Done.

1167

Done.

mlir/test/Target/LLVMIR/Import/intrinsic.ll
4

The first function would be placed at the end of mlir file, so I add a empty function to keep the CHECK works.

13

Done, thanks.

464

Done.

jacquesguan marked 6 inline comments as done.May 31 2022, 12:43 AM
ftynse accepted this revision.May 31 2022, 1:34 AM
ftynse added inline comments.
mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
658

Nit: this returns StringRef, not OperationName.

This revision is now accepted and ready to land.May 31 2022, 1:34 AM
This revision was landed with ongoing or failed builds.May 31 2022, 4:09 AM
This revision was automatically updated to reflect the committed changes.