This is an archive of the discontinued LLVM Phabricator instance.

[IR/MachineOutliner] Add a "nooutline" function attr and respect it
ClosedPublic

Authored by paquette on Dec 20 2022, 3:24 PM.

Details

Summary

Add nooutline + update LangRef to say it exists.

This makes it possible to say "don't outline from this function ever."

We want to be able to toggle whether or not a function should be in the search set regardless of default behaviour.

Add testcases for the IR + Machine outliners.

Diff Detail

Event Timeline

paquette created this revision.Dec 20 2022, 3:24 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 20 2022, 3:24 PM
paquette requested review of this revision.Dec 20 2022, 3:24 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 20 2022, 3:24 PM

(somewhat straightforward, but I feel like adding something to the langref requires a LGTM from someone)

arsenm added a subscriber: arsenm.Dec 20 2022, 3:26 PM
arsenm added inline comments.
llvm/docs/LangRef.rst
1851

This is documented as a first class enum attribute, but the code is using a string attribute. If it's an enum attribute, the code needs to change. If it's a string attribute, it should go below with the others and be expressed with quotes

llvm/test/Transforms/IROutliner/nooutline-attribute.ll
21

No typed pointers in new tests

arsenm added inline comments.Dec 20 2022, 3:29 PM
llvm/docs/LangRef.rst
1852

"should ever"

llvm/lib/CodeGen/MachineOutliner.cpp
882–889

Normal check would be skip declaration, F.empty for a defined function is invalid

paquette added inline comments.Dec 20 2022, 3:32 PM
llvm/docs/LangRef.rst
1851

It doesn't seem like these are grouped by being string attributes/not string attributes.

The last string attribute is "min-legal-vector-width"; should I move it after that?

nikic added a subscriber: nikic.Dec 21 2022, 3:01 AM

FWIW, if something affects IR semantics, I'd generally expect it to be a first-class attribute.

FWIW, if something affects IR semantics, I'd generally expect it to be a first-class attribute.

Would it be better for me to move it to Attributes.td, then?

FWIW, if something affects IR semantics, I'd generally expect it to be a first-class attribute.

Would it be better for me to move it to Attributes.td, then?

I don't have a particularly strong opinion either way. I don't think I'd go so far as to say this changes IR semantics, it just turns off one transform

paquette updated this revision to Diff 484630.Dec 21 2022, 11:15 AM
  • Remove typed pointers from IR test
  • Move the attribute in the docs and mark it as a string
  • Remove unnecessary check for empty function in the MachineOutliner
  • Improve wording in docs

I don't have a particularly strong opinion either way. I don't think I'd go so far as to say this changes IR semantics, it just turns off one transform

Okay, let's go with the string attribute then.

Good to go then?

nikic accepted this revision.Dec 22 2022, 1:50 AM

LGTM

This revision is now accepted and ready to land.Dec 22 2022, 1:50 AM
This revision was landed with ongoing or failed builds.Dec 22 2022, 10:22 AM
This revision was automatically updated to reflect the committed changes.
aaron.ballman added inline comments.
llvm/docs/LangRef.rst
2235–2237

This broke the sphinx build (https://lab.llvm.org/buildbot/#/builders/30/builds/30072) and I think you can fix it with this suggested edit.

paquette added inline comments.Dec 22 2022, 11:45 AM
llvm/docs/LangRef.rst
2235–2237

Oops, should be fixed.

aaron.ballman added inline comments.Dec 23 2022, 6:26 AM
llvm/docs/LangRef.rst
2235–2237

Thank you! I confirmed everything is good again.