[llvm] [clang] [PGO] Add ability to mark cold functions as optsize/minsize/optnone (PR #69030)

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 5 12:25:13 PST 2024


aeubanks wrote:

> How does this relate to the existing `shouldOptimizeForSize(Function&, ...)` and `shouldOptimizeForSize(MachineFunction&, ...)` APIs which appear to provide similar functionality at a first glance. If they are the same, then we should have a plan in place to cleanup and only have one system afterwards, if there are important differences, then I wouldn't mind some comments explaining them.

This is intended to replace `shouldOptimizeForSize()`. We've seen multiple cases of calls to `shouldOptimizeForSize()` blowing up compile times if we're not being careful with the calls to it, since it ends up calling expensive profile information code. The replacement is to just check if the function has the `optsize`/`minsize` attribute. I'll mention this in the description.

The basic block versions of these should remain as they are since they actually do need to look at profile information to determine per-block information.

https://github.com/llvm/llvm-project/pull/69030


More information about the llvm-commits mailing list