[PATCH] D11605: [LoopUnswitch] Add block frequency analysis to recognize hot/cold regions
David Li via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 10 11:32:25 PDT 2015
davidxl added inline comments.
================
Comment at: lib/Transforms/Scalar/LoopUnswitch.cpp:88
@@ +87,3 @@
+static cl::opt<unsigned>
+ColdFrequency("loop-unswitch-cold-block-frequency", cl::init(20), cl::Hidden,
+ cl::desc("Block frequency to be considered as cold. Non-trivial "
----------------
reames wrote:
> I think the default here should be much lower, but we can tune this in separate changes. My guess here would be something like 1/100 rather than 20/100. I also think we should have an absolute cutoff, but again, we can tune separately.
This is not frequency. Maybe call it 'ColdnessThreshold' or something.
================
Comment at: lib/Transforms/Scalar/LoopUnswitch.cpp:89
@@ +88,3 @@
+ColdFrequency("loop-unswitch-cold-block-frequency", cl::init(20), cl::Hidden,
+ cl::desc("Block frequency to be considered as cold. Non-trivial "
+ "unswitches are not applied to cold blocks."));
----------------
It is the 'Coldness threshold in percent. The loop header frequency (relative to the entry frequency) is compared with the threshold to determine if non-trivial unswitching should be enabled.'
================
Comment at: lib/Transforms/Scalar/LoopUnswitch.cpp:441
@@ +440,3 @@
+
+ if (LoopUnswitchWithBlockFrequency) {
+ BranchProbabilityInfo BPI(*F, *LI);
----------------
Note that this also triggers the check when PGO is not enabled (e.g, with static prediction).
To check if PGO is on, do:
HasProfileData = F.getEntryCount().hasValue();
if (HasProfileData) {
..
http://reviews.llvm.org/D11605
More information about the llvm-commits
mailing list