<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hi Evgeny,<br>
</p>
<br>
<div class="moz-cite-prefix">On 2018-10-30 18:54, Evgeny Astigeevich
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:8EB85B69-CEA9-4D94-982A-24DB27A2EA46@arm.com">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Hi Jonas,
<div class=""><br class="">
</div>
<div class="">I tried to trace the history of the code. I found it
was introduced in r172998(<a
href="http://www.llvm.org/viewvc/llvm-project?view=revision&revision=172998"
class="" moz-do-not-send="true">http://www.llvm.org/viewvc/llvm-project?view=revision&revision=172998</a>)
in 2013. I don’t see any tests in the commit.</div>
<div class="">I think this code might be outdated. Maybe it was
related to vector code.</div>
</blockquote>
I agree with you that this code does not seem to make any sense - at
least not on SystemZ, X86 or ARM...<br>
<br>
<blockquote type="cite"
cite="mid:8EB85B69-CEA9-4D94-982A-24DB27A2EA46@arm.com">
<div class="">There are tests for vector code.
See test/Analysis/CostModel/SystemZ/cmp-ext.ll.</div>
</blockquote>
I think those tests are for CostModel which use getCastInstrCost(),
and I can't find any tests at all for getUserCost(), but perhaps
there are.<br>
<br>
<blockquote type="cite"
cite="mid:8EB85B69-CEA9-4D94-982A-24DB27A2EA46@arm.com">
<div class="">I don’t know if there are any tests for scalar code.</div>
<div class="">I checked the inline cost calculation. In case of
the ARM targets the cost of the cast was reported as free but it
was lowered into real instruction. Of course, they are very
light and have no impact at O2/O3 because of very high inlining
thresholds. However they will have impact at Os/Oz where
thresholds are much lower.</div>
</blockquote>
Inliner is just one user. CodeMetrics uses getUserCost(), and in
turn some loop passes uses it. For instance, the LoopRotation
default threshold for the header size is 16, which makes this patch
relevant, I think.<br>
<br>
I simply removed the code, and no tests failed. This seems
reasonable to me, please take a look at the Phabricator post
<a class="moz-txt-link-freetext" href="https://reviews.llvm.org/D53373">https://reviews.llvm.org/D53373</a>.<br>
<br>
Since there does not seem to be any tests for getUserCost(), I
removed the one I had made also, which was using the LoopUnroller to
get the loop size in an awkward way.<br>
<br>
Thanks<br>
<br>
Jonas<br>
<blockquote type="cite"
cite="mid:8EB85B69-CEA9-4D94-982A-24DB27A2EA46@arm.com">
<div class=""><br class="">
</div>
<div class="">Thanks,</div>
<div class="">Evgeny Astigeevich </div>
<div class=""><br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 26 Oct 2018, at 14:20, Jonas Paulsson <<a
href="mailto:paulsson@linux.vnet.ibm.com" class=""
moz-do-not-send="true">paulsson@linux.vnet.ibm.com</a>>
wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">Hi,<br class="">
<br class="">
I wonder why the extension of i1 is per default
considered free in getUserCost(). The comment says that
these are "mostly optimized away in codegen", but I
wonder how that can be: If the i1 is extended then a
register must be loaded with either a 0 or (-)1 after
the comparison, or?<br class="">
<br class="">
I have made some test functions that seem to result in
compare + conditional move on SystemZ (or a setcc on
Intel). See
<a href="https://reviews.llvm.org/D53373" class=""
moz-do-not-send="true">https://reviews.llvm.org/D53373</a>.
On both of these targets this is clearly not free.<br
class="">
<br class="">
Are those simple tests I made special in any way so that
they might call for some general rule in the generic
implementation?<br class="">
<br class="">
Any example of when this extension is actually free?<br
class="">
<br class="">
/Jonas<br class="">
<br class="">
<br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</blockquote>
<br>
</body>
</html>