This is an archive of the discontinued LLVM Phabricator instance.

[RFC][Flang][OMPIRBuilder] Add nounwind attribute to the LLVM IR
Needs ReviewPublic

Authored by domada on Mar 31 2023, 6:06 AM.

Details

Summary

Check if generated code can be marked as the code which does not throw an exception.

If LLVM IR does not throw an exception, add nounwind function attribute.

This patch depends on https://reviews.llvm.org/D147313

Diff Detail

Event Timeline

domada created this revision.Mar 31 2023, 6:06 AM
Herald added a reviewer: dcaballe. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
domada requested review of this revision.Mar 31 2023, 6:06 AM
Herald added projects: Restricted Project, Restricted Project, Restricted Project. · View Herald Transcript
domada updated this revision to Diff 515259.Apr 20 2023, 2:17 AM

Patch rebased

domada retitled this revision from [Flang][OMPIRBuilder] Add nounwind attribute to the LLVM IR to [WIP][Flang][OMPIRBuilder] Add nounwind attribute to the LLVM IR.Apr 24 2023, 7:51 AM
domada retitled this revision from [WIP][Flang][OMPIRBuilder] Add nounwind attribute to the LLVM IR to [RFC][Flang][OMPIRBuilder] Add nounwind attribute to the LLVM IR.Apr 28 2023, 7:47 AM
jdoerfert added inline comments.May 15 2023, 8:40 AM
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
5063

Style F

5063

Why does this belong here? We should do it like clang, one function at a time, or in a generic place. This is not OpenMP specific at all.

llvm/lib/IR/IRBuilder.cpp
1426

No llvm::

domada added inline comments.May 25 2023, 6:24 AM
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
5063

Hi Johannes,
thank you very much for your feedback.

I would like to explain my idea why I add this function to OMPIRBuilder:

Current situation:

  1. MLIR does not support LLVM IR function attributes for production quality code. MLIR function passthrough attributes should be used only for PoC work ( https://mlir.llvm.org/docs/Dialects/LLVM/#attribute-pass-through )
  2. OpenMP MLIR operations can be translated into multiple LLVM IR functions.

My idea was to add functionality of inserting function attributes after the end of OpenMP MLIR code translation. OMPIRBuilder has necessary knowledge about generated LLVM IR. That's why I decided to do it here and to focus mainly on the code generated for OpenMP pragmas.