<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<br>
<br>
<div class="moz-cite-prefix">On 12/21/2015 09:29 AM, Robinson, Paul
via llvm-dev wrote:<br>
</div>
<blockquote
cite="mid:E3B07FDB86BFF041819DC057DEED8FEAC83A026A@USCULXMSG08.am.sony.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.hoenzb
{mso-style-name:hoenzb;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">|
</span>(canonicalizeOperands swaps arguments of an and and
then ReassociateExpression swaps them back).<span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><a moz-do-not-send="true"
name="_MailEndCompose"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></a></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">That
feels like its own bug, canonicalize and reassociate having
different opinions of canonical order. Just saying.</span></p>
</div>
</blockquote>
It definitely is. However, we seem to have a good number of these
types of bugs. Nothing in our current test infrastructure reveals
them, so they seem to be relatively widespread. <br>
<br>
Might be worthing adding an assertion to the pass manager that the
hash of a changed module differs from the hash of the original?<br>
<blockquote
cite="mid:E3B07FDB86BFF041819DC057DEED8FEAC83A026A@USCULXMSG08.am.sony.com"
type="cite">
<div class="WordSection1">
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">--paulr<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in
0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">
llvm-dev [<a class="moz-txt-link-freetext" href="mailto:llvm-dev-bounces@lists.llvm.org">mailto:llvm-dev-bounces@lists.llvm.org</a>]
<b>On Behalf Of </b>Artur Pilipenko via llvm-dev<br>
<b>Sent:</b> Monday, December 21, 2015 9:11 AM<br>
<b>To:</b> Russell Wallace<br>
<b>Cc:</b> llvm-dev<br>
<b>Subject:</b> Re: [llvm-dev] Hash of a module<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">There is a caveat here. I was
experimenting with something similar and found that this
status is not always trustworthy. I fixed one bug in
prune-eh. These is also a bug in reassociate pass. It
returns true with no change made on the following
instruction: <o:p></o:p></p>
<div>
<p class="MsoNormal"> %0 = and i64 %b, %a<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">It happens because it performs two
distinct transformations which nullify each other
(canonicalizeOperands swaps arguments of an and and then
ReassociateExpression swaps them back).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">This approach might work for your set
of passes, but beware of the problem.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Artur<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">On 21 Dec 2015, at 19:59, Russell
Wallace <<a moz-do-not-send="true"
href="mailto:russell.wallace@gmail.com">russell.wallace@gmail.com</a>>
wrote:<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">Yes, I'm running all the
existing passes that I know how to run. I didn't
know they returned change-made. Thanks!<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Mon, Dec 21, 2015 at 12:36
PM, Artur Pilipenko <<a
moz-do-not-send="true"
href="mailto:apilipenko@azulsystems.com"
target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:apilipenko@azulsystems.com">apilipenko@azulsystems.com</a></a>>
wrote:<o:p></o:p></p>
<p class="MsoNormal">Are you going to run some of
the existing passes? Why can’t you just use the
returned change-made value from the passes?<br>
<span style="color:#888888"><br>
<span class="hoenzb">Artur</span></span><o:p></o:p></p>
<div>
<div>
<p class="MsoNormal"><br>
> On 20 Dec 2015, at 15:43, Russell
Wallace via llvm-dev <<a
moz-do-not-send="true"
href="mailto:llvm-dev@lists.llvm.org"><a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a></a>>
wrote:<br>
><br>
> I want to run a bunch of optimizations,
iteratively, that is keep running until
things stop changing (to make sure all
optimization opportunities are taken). As
far as I know, there is no way to copy a
module or compare modules by value, so it
occurs to me that a practical solution might
be to take the hash code of the module and
see if that changes.<br>
><br>
> A problem is that hash algorithms are
designed to work on streams of bytes, not
compound objects.<br>
><br>
> First attempt at a solution: iterate
through all instructions in all functions
and hash the instruction kinds. I can think
of some possible changes that would fail to
be captured by that.<br>
><br>
> Is there any already known solution?<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"
style="margin-bottom:12.0pt">>
_______________________________________________<br>
> LLVM Developers mailing list<br>
> <a moz-do-not-send="true"
href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
> <a moz-do-not-send="true"
href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev"
target="_blank">
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><o:p></o:p></p>
</div>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
</blockquote>
<br>
</body>
</html>