llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.33k stars 12.13k forks source link

Recommend -fprofile-generate instead of -fprofile-instr-generate for PGO in Clang's user manual #45668

Open zmodem opened 4 years ago

zmodem commented 4 years ago
Bugzilla Link 46323
Version trunk
OS Linux
CC @gburgessiv,@LebedevRI

Extended Description

Clang's user manual currently recommends -fprofile-instr-generate for instrumentation based profile-guided optimization (https://clang.llvm.org/docs/UsersManual.html#profiling-with-instrumentation)

Towards the end of that section, there is a part about -fprofile-generate saying it's an alternative instrumentation method.

However, my understanding is that -fprofile-generate is really better for PGO (it supports value profiling for example), and -fprofile-instr-generate is best left for code coverage analysis.

If my understand is correct, can we update the docs to reflect this?

zamazan4ik commented 1 year ago

I can confirm that your understanding is correct according to the discussions in https://discourse.llvm.org/t/profile-guided-optimization-pgo-related-questions-and-suggestions/75232 and https://discourse.llvm.org/t/status-of-ir-vs-frontend-pgo-fprofile-generate-vs-fprofile-instr-generate/58323