<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-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;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.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]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">My reply below seems to have accidentally dropped the mailing list, so I’m resending.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><a name="_____replyseparator"></a><b>From:</b> Kaylor, Andrew
<br>
<b>Sent:</b> Monday, January 14, 2019 1:40 PM<br>
<b>To:</b> Juneyoung Lee <juneyoung.lee@sf.snu.ac.kr>; Chandler Carruth <chandlerc@gmail.com><br>
<b>Cc:</b> Zhengyang Liu <liuz@cs.utah.edu>; Ralf Jung <jung@mpi-sws.org>; John Regehr <regehr@cs.utah.edu>; Nuno Lopes <nlopes@microsoft.com><br>
<b>Subject:</b> RE: [llvm-dev] Reducing the number of ptrtoint/inttoptrs that are generated by LLVM<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">We recently came across a related issue where the InstCombine change that introduces ptrtoint can block mem2reg promotions. We did indeed track it back to a change Chandler made that was specifically introducting this as a canonicalization.
 The change was r226781. Here’s the commit message:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">---<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:8.0pt;font-family:"Courier New"">[canonicalize] Teach InstCombine to canonicalize loads which are only<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:8.0pt;font-family:"Courier New"">ever stored to always use a legal integer type if one is available.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:8.0pt;font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:8.0pt;font-family:"Courier New"">Regardless of whether this particular type is good or bad, it ensures we<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:8.0pt;font-family:"Courier New"">don't get weird differences in generated code (and resulting<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:8.0pt;font-family:"Courier New"">performance) from "equivalent" patterns that happen to end up using<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:8.0pt;font-family:"Courier New"">a slightly different type.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:8.0pt;font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:8.0pt;font-family:"Courier New"">After some discussion on llvmdev it seems everyone generally likes this<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:8.0pt;font-family:"Courier New"">canonicalization. However, there may be some parts of LLVM that handle<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:8.0pt;font-family:"Courier New"">it poorly and need to be fixed. I have at least verified that this<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:8.0pt;font-family:"Courier New"">doesn't impede GVN and instcombine's store-to-load forwarding powers in<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:8.0pt;font-family:"Courier New"">any obvious cases. Subtle cases are exactly what we need te flush out if<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:8.0pt;font-family:"Courier New"">they remain.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:8.0pt;font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:8.0pt;font-family:"Courier New"">Also note that this IR pattern should already be hitting LLVM from Clang<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:8.0pt;font-family:"Courier New"">at least because it is exactly the IR which would be produced if you<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:8.0pt;font-family:"Courier New"">used memcpy to copy a pointer or floating point between memory instead<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:8.0pt;font-family:"Courier New"">of a variable.<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">---<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Based on the third paragraph there, we have been exploring the possibility of teaching mem2reg to handle the ptrtoint cast rather than removing the canonicalization. Personally, I would be happy to see pointers loaded and stored directly
 without the canonicalization if that doesn’t break other optimizations.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I don’t know if the mem2reg fix we’re working on would take care of Juneyoung’s store-to-load forwarding issues.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">-Andy<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b>From:</b> llvm-dev <<a href="mailto:llvm-dev-bounces@lists.llvm.org">llvm-dev-bounces@lists.llvm.org</a>>
<b>On Behalf Of </b>Juneyoung Lee via llvm-dev<br>
<b>Sent:</b> Monday, January 14, 2019 12:56 PM<br>
<b>To:</b> Chandler Carruth <<a href="mailto:chandlerc@gmail.com">chandlerc@gmail.com</a>><br>
<b>Cc:</b> llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>>; Zhengyang Liu <<a href="mailto:liuz@cs.utah.edu">liuz@cs.utah.edu</a>>; Ralf Jung <<a href="mailto:jung@mpi-sws.org">jung@mpi-sws.org</a>>; John Regehr <<a href="mailto:regehr@cs.utah.edu">regehr@cs.utah.edu</a>>;
 Nuno Lopes <<a href="mailto:nlopes@microsoft.com">nlopes@microsoft.com</a>><br>
<b>Subject:</b> Re: [llvm-dev] Reducing the number of ptrtoint/inttoptrs that are generated by LLVM<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<div>
<p class="MsoNormal">Hello Chandler,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">> First and foremost - how do you address correctness issues here? Because the subtraction `A - B` can escape/capture more things. Specifically, if one of `A` or `B` is escaped/captured, the<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">> subtraction can be used to escape or capture the other pointer. So *some* of the conservative treatment is necessary. What is the plan to update all the analyses to remain correct? What<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">> correctness testing have you done?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Correctness of psub is guaranteed by the specification of pointer subtraction of C/C++. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">When two pointers are subtracted, both shall point to elements of the same array object, or one past the last element of the array object (6.5.6.9).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">So, if the two pointers p and q point to different objects, we can define llvm.psub(p,q) as poison.<o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">Other than meeting C specification, correctness of llvm.psub is tested with SPEC CPU2017 and LLVM Nightly Tests as well.<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">But it is true that sometimes pointer subtraction is used to get distance between two objects.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Most common case is doing something like 'p - NULL', and this pattern exists in SPEC CPU2017, for example spec_qsort.c in mcf_r .<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Our suggestion is to define 'p - q' correctly return the distance between p and q if either p or q is based on inttoptr(i). This naturally explains 'p - NULL' because NULL is equivalent to inttoptr(0).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Regarding analysis - what I've observed is that analysis was done after pointer subtraction was optimized into another form.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">For example, if '(p - q) == 0' was given, this is transformed into 'p == q', and then some analysis was done.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Good thing is that these transformations can be simply applied to llvm.psub as well, which will reenable analysis.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Also we're adding a new operation here, so existing analysis wouldn't be incorrect, but wouldn't fire.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Fortunately, the performance impact after changing llvm.psub wasn't big.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">> Second - an intrinsic seems a poor fit here given the significance of this operation. We have an instruction that covers most pointer arithmetic (`getelementptr`), and I can imagine growing <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">> pointer subtraction, but it seems like it should be an instruction if we're going to have it. Based on the above, we will need to use it very often in analysis.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I also think that defining psub as instruction is fine. :)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">> Regarding the instcombine, it should be very easy to keep loads and stores of pointers as pointer typed in instcombine. Likely just a missing case in the code I added/touched there. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">That's really good. :) I found that  combineLoadToOperationType from InstCombineLoadStoreAlloca was responsible for the transformation.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">I can upload a patch for that if ok.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Best Regards,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Juneyoung Lee<o:p></o:p></p>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Mon, Jan 14, 2019 at 5:36 PM Chandler Carruth <<a href="mailto:chandlerc@gmail.com">chandlerc@gmail.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">While I'm very interested in the end result here, I have some questions that don't seem well answered yet around pointer subtraction...<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">First and foremost - how do you address correctness issues here? Because the subtraction `A - B` can escape/capture more things. Specifically, if one of `A` or `B` is escaped/captured, the subtraction can be used to escape or capture the
 other pointer. So *some* of the conservative treatment is necessary. What is the plan to update all the analyses to remain correct? What correctness testing have you done?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Second - an intrinsic seems a poor fit here given the significance of this operation. We have an instruction that covers most pointer arithmetic (`getelementptr`), and I can imagine growing pointer subtraction, but it seems like it should
 be an instruction if we're going to have it. Based on the above, we will need to use it very often in analysis.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Regarding the instcombine, it should be very easy to keep loads and stores of pointers as pointer typed in instcombine. Likely just a missing case in the code I added/touched there.<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Mon, Jan 14, 2019 at 3:23 AM Juneyoung Lee via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<div>
<div>
<div>
<p class="MsoNormal">Hello all,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">This is a proposal for reducing # of ptrtoint/inttoptr casts which are not<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">written by programmers but rather generated by LLVM passes.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Currently the majority of ptrtoint/inttoptr casts are generated by LLVM;<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">when compiling SPEC 2017 with LLVM r348082 (Dec 2 2018) with -O3,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">the output IR contains 22,771 inttoptr instructions. However, when<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">compiling it with -O0, there are only 1048 inttoptrs, meaning that 95.4%<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">of them are generated by LLVM passes.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">This trend is similar in ptrtoint instruction as well. When compiling SPEC 2017<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">with -O0, there are 23,208 ptrtoint instructions, but among them 22,016 (94.8%)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">are generated by Clang frontend to represent pointer subtraction.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">They aren't effectively optimized out because there are even more ptrtoints (31,721) after -O3.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">This is bad for performance because existence of ptrtoint makes analysis return conservative<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">result as a pointer can be escaped through the cast.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Memory accesses to a pointer came from inttoptr is assumed<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">to possibly access anywhere, therefore it may block<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">store-to-load forwarding, merging two same loads, etc.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I believe this can be addressed by applying two patches - first one is representing pointer subtraction with a dedicated intrinsic function, llvm.psub, and second one is disabling InstCombine transformation<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">    %q = load i8*, i8** %p1<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">    store i8* %q, i8** %p2<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">=><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">  %1 = bitcast i8** %p1 to i64*<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">  %q1 = load i64, i64* %1, align 8<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">  %2 = bitcast i8** %p2 to i64*<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">  store i64 %q1, i64* %2, align 8<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">This transformation can introduce inttoptrs later if loads are followed (<a href="https://godbolt.org/z/wsZ3II" target="_blank">https://godbolt.org/z/wsZ3II</a> ). Both are discussed in <a href="https://bugs.llvm.org/show_bug.cgi?id=39846" target="_blank">https://bugs.llvm.org/show_bug.cgi?id=39846</a>
 as well.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">After llvm.psub is used & this transformation is disabled, # of inttoptrs decreases from 22,771 to 1,565 (6.9%), and # of ptrtoints decreases from 31,721 to 7,772 (24.5%).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I'll introduce llvm.psub patch first.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">--- Adding llvm.psub ---<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">By defining pointer subtraction intrinsic, we can get performance gain because it gives more undefined behavior than just subtracting two ptrtoints.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Patch <a href="https://reviews.llvm.org/D56598" target="_blank">
https://reviews.llvm.org/D56598</a> adds llvm.psub(p1,p2) intrinsic function, which subtracts two pointers and returns the difference. Its semantic is as follows.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">If p1 and p2 point to different objects, and neither of them is based on a pointer casted from an integer, `llvm.psub(p1, p2)` returns poison. For example,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">%p = alloca<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">%q = alloca<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">%i = llvm.psub(p, q) ; %i is poison<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">This allows aggressive escape analysis on pointers. Given i = llvm.psub(p1, p2), if neither of p1 and p2 is based on a pointer casted from an integer, the llvm.psub call does not make p1 or p2 escape. (<a href="https://reviews.llvm.org/D56601" target="_blank">https://reviews.llvm.org/D56601</a>
 )<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">If either p1 or p2 is based on a pointer casted from integer, or p1 and p2 point to a same object, it returns the result of subtraction (in bytes); for example,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">%p = alloca<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">%q = inttoptr %x<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">%i = llvm.psub(p, q) ; %i is equivalent to (ptrtoint %p) - %x<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">`null` is regarded as a pointer casted from an integer because<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">it is equivalent to `inttoptr 0`.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Adding llvm.psub allows LLVM to utilize significant portion of ptrtoints & reduce a portion of inttoptrs. After llvm.psub is used, when SPECrate 2017 is compiled with -O3, # of inttoptr decreases to ~13,500 (59%) and # of ptrtoint decreases
 to ~14,300 (45%).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">To see the performance change, I ran SPECrate 2017 (thread # = 1) with three versions of LLVM, which are r313797 (Sep 21, 2017), LLVM 6.0 official, and r348082 (Dec 2, 2018). <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Running r313797 shows that 505.mcf_r has consistent 2.0% speedup over 3 different machines (which are i3-6100, i5-6600, i7-7700). For LLVM 6.0 and r348082, there's neither consistent speedup nor slowdown, but the average speedup is near
 0. I believe there's still a room of improvement because there are passes which are not aware of llvm.psub.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Thank you for reading this, and any comment is welcome.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Best Regards,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Juneyoung Lee<o:p></o:p></p>
</div>
</div>
</div>
</div>
<p class="MsoNormal">_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a 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>
</blockquote>
</div>
</blockquote>
</div>
<p class="MsoNormal"><br clear="all">
<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">-- <o:p></o:p></p>
<div>
<div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal"><span style="font-size:7.5pt">Juneyoung Lee</span><o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:7.5pt">Software Foundation Lab, Seoul National University</span><o:p></o:p></p>
</div>
</div>
</div>
</div>
</body>
</html>