While this is interesting, it isn't what I'm looking at. I don't have any test cases that currently point a finger at extendInBlock (but that may change, see below).<div><br></div><div>I'm working on a patch to fix the super-linear performance of MergeValueInAsValue (and MergeRangeInAsValue). I've two or three ideas, and should have a patch mailed out today.</div>
<div><br></div><div>I spotted the merge-able remove calls by inspection, and was inspecting it because the remove is what makes the above super-linear so it showed up blazing hot in the profile.</div><div><br></div><div>I never really expected this patch to make a big difference, it only seemed worth it because the code actually became simpler in the process.</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jul 5, 2012 at 9:49 AM, Jakob Stoklund Olesen <span dir="ltr"><<a href="mailto:stoklund@2pi.dk" target="_blank">stoklund@2pi.dk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><div><div class="h5"><div>On Jul 5, 2012, at 8:36 AM, Jakob Stoklund Olesen <<a href="mailto:stoklund@2pi.dk" target="_blank">stoklund@2pi.dk</a>> wrote:</div>
<br><blockquote type="cite"><div style="word-wrap:break-word"><br><div><div>On Jul 5, 2012, at 5:40 AM, Chandler Carruth <<a href="mailto:chandlerc@gmail.com" target="_blank">chandlerc@gmail.com</a>> wrote:</div><br>
<blockquote type="cite"><span style="font-family:monospace;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:inline!important;float:none">Author: chandlerc</span><br style="font-family:monospace;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<span style="font-family:monospace;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:inline!important;float:none">Date: Thu Jul  5 07:40:45 2012</span><br style="font-family:monospace;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<span style="font-family:monospace;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:inline!important;float:none">New Revision: 159746</span><br style="font-family:monospace;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br style="font-family:monospace;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<span style="font-family:monospace;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:inline!important;float:none">URL:<span> </span></span><a href="http://llvm.org/viewvc/llvm-project?rev=159746&view=rev" style="font-family:monospace;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">http://llvm.org/viewvc/llvm-project?rev=159746&view=rev</a><br style="font-family:monospace;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<span style="font-family:monospace;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:inline!important;float:none">Log:</span><br style="font-family:monospace;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<span style="font-family:monospace;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:inline!important;float:none">Optimize extendIntervalEndTo a tiny bit by saving one call through the</span><br style="font-family:monospace;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<span style="font-family:monospace;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:inline!important;float:none">vector erase. No functionality changed.</span><br style="font-family:monospace;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
</blockquote></div><br><div>This function is very hot when called from LiveInterval::extendInBlock(), and in that case it is known that the new live range doesn't overlap any existing live ranges.</div><div><br></div>
<div>You may be able to squeeze out a bit more performance by inlining a simpler extendIntervalEndTo() into extendInBlock(). The for-loop and std::max conditional are not needed in that case.</div></div></blockquote><div>
<br></div></div></div><div>I wasn't able to measure a performance difference with this patch:</div><div><div><br></div><div>diff --git a/lib/CodeGen/LiveInterval.cpp b/lib/CodeGen/LiveInterval.cpp</div><div>index 3d34c08..fc09c02 100644</div>
<div>--- a/lib/CodeGen/LiveInterval.cpp</div><div>+++ b/lib/CodeGen/LiveInterval.cpp</div><div>@@ -305,8 +305,20 @@ VNInfo *LiveInterval::extendInBlock(SlotIndex StartIdx, SlotIndex Kill) {</div><div>   --I;</div><div>   if (I->end <= StartIdx)</div>
<div>     return 0;</div><div>-  if (I->end < Kill)</div><div>-    extendIntervalEndTo(I, Kill);</div><div>+  if (I->end >= Kill)</div><div>+    return I->valno;</div><div>+</div><div>+  // I needs to be extended up to Kill.</div>
<div>+  // Check if it would merge with the next segment.</div><div>+  iterator Next = llvm::next(I);</div><div>+  if (Next == end() || Next->start != Kill || Next->valno != I->valno) {</div><div>+    I->end = Kill;</div>
<div>+    return I->valno;</div><div>+  }</div><div>+</div><div>+  // Merge Next into I.</div><div class="im"><div>+  I->end = Next->end;</div></div><div>+  ranges.erase(Next);</div><div>   return I->valno;</div>
<div> }</div><div><br></div></div></div></div><br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div>