This patch modifies the conditional compares pass so that it keeps the successor probabilities of the head block up-to-date after the conversion. Previously, the successor probabilities were being normalized to a uniform distribution, even though they may have been heavily biased prior to the conversion (e.g., if one of the edges was the back edge of a loop). This loss of information affected passes later in the pipeline.
Details
Diff Detail
- Build Status
Buildable 7157 Build 7157: arc lint + arc unit
Event Timeline
lib/Target/AArch64/AArch64ConditionalCompares.cpp | ||
---|---|---|
143 | Huh, we can use a const instance of this to change the probabilities... Looking at MachineBranchProbabilityInfo I wonder why this was implemented as a pass and not just a set of utility functions. Anyway just wanted to write this down, it isn't really relevant for the review at hand. | |
590 | I cannot convince myself right now that it is always succ_begin() that points to Tail. Wouldn't we need to search for the right successor? |
Thanks for the comments Matthias! Responses are inline.
lib/Target/AArch64/AArch64ConditionalCompares.cpp | ||
---|---|---|
143 | I agree, this was a bit confusing to me. My understanding is that MachineBranchProbabilityInfo is required for reading off the successor probabilities, but that the setting of the probabilities must be done via MachineBasicBlock. | |
590 | Head is required to have exactly two successors, CmpBB and Tail (see the beginning part of canConvert). CmpBB is removed as a successor of Head a few lines up (577), so succ_begin() can only point to Tail here. |
LGTM
lib/Target/AArch64/AArch64ConditionalCompares.cpp | ||
---|---|---|
590 | Ok, maybe check with an assert() to make life easier for readers? |
Huh, we can use a const instance of this to change the probabilities... Looking at MachineBranchProbabilityInfo I wonder why this was implemented as a pass and not just a set of utility functions. Anyway just wanted to write this down, it isn't really relevant for the review at hand.