Skip to content

Should we have a llvm.loop.optsize/minsize attribute #159595

@lukel97

Description

@lukel97

This stems from the discussion in #159522. That PR aims to use PGOForceFunctionAttrsPass (added in #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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImproving things as opposed to bug fixing, e.g. new or missing feature

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions