diff options
author | Jessica Paquette <jpaquette@apple.com> | 2022-12-20 15:16:18 -0800 |
---|---|---|
committer | Jessica Paquette <jpaquette@apple.com> | 2022-12-22 10:22:08 -0800 |
commit | 7ef8f9c972bbcb37eba47d43b100c84c6ff8cb83 (patch) | |
tree | bfe8fe4d3dc6fd814145867f3cc03d02ced9cd79 /llvm/lib/CodeGen/MachineOutliner.cpp | |
parent | 51126518261a061624110b013d6cc0a414488f5b (diff) | |
download | llvm-7ef8f9c972bbcb37eba47d43b100c84c6ff8cb83.zip llvm-7ef8f9c972bbcb37eba47d43b100c84c6ff8cb83.tar.gz llvm-7ef8f9c972bbcb37eba47d43b100c84c6ff8cb83.tar.bz2 |
[IR/MachineOutliner] Add a "nooutline" function attr and respect it
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 Outliner + Machine Outliner.
Also remove an unnecessary check for an empty function in the Machine Outliner.
Differential Revision: https://reviews.llvm.org/D140438
Diffstat (limited to 'llvm/lib/CodeGen/MachineOutliner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineOutliner.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp index 56c3d27..c7ba66b 100644 --- a/llvm/lib/CodeGen/MachineOutliner.cpp +++ b/llvm/lib/CodeGen/MachineOutliner.cpp @@ -880,10 +880,13 @@ void MachineOutliner::populateMapper(InstructionMapper &Mapper, Module &M, // iterating over each Function in M. for (Function &F : M) { - // If there's nothing in F, then there's no reason to try and outline from - // it. - if (F.empty()) + if (F.hasFnAttribute("nooutline")) { + LLVM_DEBUG({ + dbgs() << "... Skipping function with nooutline attribute: " + << F.getName() << "\n"; + }); continue; + } // There's something in F. Check if it has a MachineFunction associated with // it. |