This is an archive of the discontinued LLVM Phabricator instance.

[mlir][llvm] Make LoopAnnotations non-discardable
ClosedPublic

Authored by Dinistro on Feb 14 2023, 12:41 AM.

Details

Summary

This commit adds the loop annotation attribute to LLVM::Br and
LLVM::CondBr to ensure it is non-discardable. Furthermore, the name is
changed from "llvm.loop" to "loop-annotation".

Diff Detail

Event Timeline

Dinistro created this revision.Feb 14 2023, 12:41 AM
Herald added a project: Restricted Project. · View Herald Transcript
Dinistro requested review of this revision.Feb 14 2023, 12:41 AM
gysit accepted this revision.Feb 14 2023, 3:35 AM

Thanks LGTM!

mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
794

nit: maybe add a c-style comment that these are the loop annotations /*loop_annotations=*/ here and below.

mlir/lib/Target/LLVMIR/Dialect/LLVMIR/LLVMIRToLLVMTranslation.cpp
207

nit: I would probably for symmetry reason also go for branchOp, see comment below

mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
1250

nit: branchOp?

This revision is now accepted and ready to land.Feb 14 2023, 3:35 AM
Dinistro updated this revision to Diff 497282.Feb 14 2023, 5:12 AM
Dinistro marked 2 inline comments as done.

address review comments and move a builder to the cpp file.

This revision was automatically updated to reflect the committed changes.