Should we have a llvm.loop.optsize/minsize attribute
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
This stems from the discussion in https://github.com/llvm/llvm-project/pull/159522. That PR aims to use PGOForceFunctionAttrsPass (added in https://github.com/llvm/llvm-project/pull/69030) to prevent SimpleLoopUnswitch from increasing the code size of cold functions.
Is it worthwhile to have a loop-level equivalent, something like PGOForceLoopAttrsPass that annotates cold loops with a `llvm.loop.optsize` attribute or equivalent?
We have the llvm.loop.unroll.disable attribute for LoopUnroll, but this would be more general. Just from a quick grep in llvm/lib/Transforms/Scalar it looks like LoopUnroll, SimpleLoopUnswitch, LoopBoundSplit, LoopLoadElimination and LoopIdiomRecognize could take advantage of this to get more granular behaviour.
cc) @aeubanks @nikic @fhahn @teresajohnson
Contributor guide
Assessment
This issue has not been assessed yet.