This is an archive of the discontinued LLVM Phabricator instance.

[clang] Add `__attribute__((nooutline))`
Needs RevisionPublic

Authored by paquette on May 16 2023, 5:13 PM.

Details

Summary

Sometimes users want to toggle which functions should be outlined from. Users could be trying to:

  1. Debug the compiler and disable outlining in some contexts
  2. Control where outlining actually happens in their program

This adds a frontend attribute that will allow users to toggle this behaviour on specific functions.

Diff Detail

Event Timeline

paquette created this revision.May 16 2023, 5:13 PM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: StephenFan. · View Herald Transcript
paquette requested review of this revision.May 16 2023, 5:13 PM
paquette added a reviewer: zainja.
jroelofs accepted this revision.May 16 2023, 5:21 PM

LGTM

clang/include/clang/Basic/Attr.td
1474

does it make sense on Block too?

This revision is now accepted and ready to land.May 16 2023, 5:21 PM
paquette added inline comments.May 16 2023, 9:38 PM
clang/include/clang/Basic/Attr.td
1474

Oh good idea

paquette updated this revision to Diff 522894.May 16 2023, 9:39 PM

Also support blocks

aaron.ballman requested changes to this revision.May 17 2023, 4:32 AM

The changes are missing Sema tests for diagnosing incorrect appertainment, arguments, etc. It would also be good to have a CodeGen test showing the behavior works on an ObjC method and a C++ lambda. This should also come with a release note in clang/docs/ReleaseNotes.rst (there's a section specifically for attributes).

clang/include/clang/Basic/AttrDocs.td
587–588

I'd appreciate a bit more explanation/link to what outlining *is*. These docs don't really help a user understand the feature (the example is especially confusing because it shows typical C code with no explanation as to what happens with the attribute).

This revision now requires changes to proceed.May 17 2023, 4:32 AM

Also, precommit CI found valid test failures that need to be addressed.