<div dir="ltr"><div><div>   unsigned calculateRegionSplitCost(LiveInterval &VirtReg,</div><div>                                     AllocationOrder &Order,</div></div><div>-                                    BlockFrequency &BestCost,</div>
<div>+                                    const BlockFrequency &AlternateCost,</div><div><div> unsigned RAGreedy::calculateRegionSplitCost(LiveInterval &VirtReg,</div><div>                                             AllocationOrder &Order,</div>
<div>-                                            BlockFrequency &BestCost,</div><div>+                                            const BlockFrequency &AlternateCost,</div><div>                                             unsigned &NumCands,</div>
<div>                                             bool IgnoreCSR) {</div><div>+  BlockFrequency BestCost = AlternateCost;</div></div><div>--> The above should be separated (is there a reason for these changes?)</div><div>
<br></div><div><div>+  uint64_t FixedEntry = 1 << 14;</div><div>+  if (ActualEntry < FixedEntry)</div><div>+    CSRCost *= BranchProbability(ActualEntry, FixedEntry);</div><div>+  else if (ActualEntry <= FixedEntry * 16)</div>
<div>+    // Invert the fraction and divide.</div><div>+    CSRCost /= BranchProbability(FixedEntry, ActualEntry);</div><div>+  else</div><div>+    // Can't use BranchProbability in general, since it takes 32-bit numbers.</div>
<div>+    // This path is faster anyway, albeit less precise.</div><div>+    CSRCost = CSRCost.getFrequency() * (ActualEntry >> 14);</div></div><div>--> Are we trying to be precise when possible with this if statement? Why a fixed 16 in the 2nd condition?</div>
<div><br></div><div>Thanks,</div><div>Manman</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Apr 7, 2014 at 11:25 AM, Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Until r197284, the entry frequency was constant -- i.e., set to 2^14.<br>
Although current ToT still has a constant entry frequency, since r197284<br>
that has been an implementation detail (which is soon going to change).<br>
<br>
  - r204690 made the wrong assumption for the CSRCost metric.  Adjust<br>
    callee-saved register cost based on entry frequency.<br>
<br>
  - r185393 made the wrong assumption (although it was valid at the<br>
    time).  Update SpillPlacement.cpp::Threshold to be relative to the<br>
    entry frequency.<br>
<br>
Since ToT still has 2^14 entry frequency, this should have no observable<br>
functionality change.<br>
<br>
</blockquote></div><br></div>