<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=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@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;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;
color:black;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman",serif;
color:black;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";
color:black;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;
color:black;}
p.emailquote, li.emailquote, div.emailquote
{mso-style-name:emailquote;
mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:1.0pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;
color:black;}
span.EmailStyle21
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:#1F497D;}
span.EmailStyle22
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:#1F497D;}
span.EmailStyle23
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:799957587;
mso-list-type:hybrid;
mso-list-template-ids:-1214880770 44585902 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
{mso-level-start-at:0;
mso-level-number-format:bullet;
mso-level-text:-;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-font-family:"Times New Roman";}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";
mso-bidi-font-family:"Times New Roman";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";
mso-bidi-font-family:"Times New Roman";}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";
mso-bidi-font-family:"Times New Roman";}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l1
{mso-list-id:1592002667;
mso-list-template-ids:1509724676;}
@list l1:level1
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:"Courier New";
mso-bidi-font-family:"Times New Roman";}
@list l1:level3
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l1:level4
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l1:level5
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l1:level6
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l1:level7
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l1:level8
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l1:level9
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></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 bgcolor="white" lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><a name="_MailEndCompose"> > On the other hand, in your case, and in general, would it make sense to prevent widening beyond the largest legal integer type? The legal integer types are already in DataLayout.<o:p></o:p></a></p>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif;color:#1F4E79;mso-style-textfill-fill-color:#1F4E79;mso-style-textfill-fill-alpha:100.0%"><span style="color:windowtext">Yes, it sounds right if it does not contradict other targets behavior.
I’ll check.<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif;color:#1F4E79;mso-style-textfill-fill-color:#1F4E79;mso-style-textfill-fill-alpha:100.0%"><span style="color:windowtext">Thank you.
<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif;color:#1F4E79;mso-style-textfill-fill-color:#1F4E79;mso-style-textfill-fill-alpha:100.0%"><br>
<br>
</span><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"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal" style="margin-left:36.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo2">
<![if !supportLists]><span style="font-family:"Calibri",sans-serif;color:#2F5496"><span style="mso-list:Ignore">-<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span dir="LTR"></span><b><i><span style="color:#2F5496"> Elena<o:p></o:p></span></i></b></p>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-left:36.0pt"><a name="_____replyseparator"></a><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext">
Hal Finkel [mailto:hfinkel@anl.gov] <br>
<b>Sent:</b> Monday, January 15, 2018 21:10<br>
<b>To:</b> Demikhovsky, Elena <elena.demikhovsky@intel.com>; llvm-dev@lists.llvm.org; Sanjay Patel (spatel@rotateright.com) <spatel@rotateright.com>; Chandler Carruth (chandlerc@gmail.com) <chandlerc@gmail.com>; Quentin Colombet (qcolombet@apple.com) <qcolombet@apple.com>;
Craig Topper (craig.topper@gmail.com) <craig.topper@gmail.com><br>
<b>Cc:</b> Breger, Igor <igor.breger@intel.com><br>
<b>Subject:</b> Re: GEP transformation by InstCombiner<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal" style="margin-left:36.0pt"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt"><o:p> </o:p></p>
<div>
<p class="MsoNormal" style="margin-left:36.0pt">On 01/15/2018 12:59 PM, Demikhovsky, Elena wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">I tried to retrieve anything from DataLayout. It contains pointer size, but how can I conclude that the GEP index can’t be widened?</span><o:p></o:p></p>
</blockquote>
<p class="MsoNormal" style="margin-left:36.0pt"><br>
I meant that we'd add a new field giving the preferred size for indexing arithmetic. On the other hand, in your case, and in general, would it make sense to prevent widening beyond the largest legal integer type? The legal integer types are already in DataLayout.<br>
<br>
-Hal<br>
<br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </span><o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-left:72.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo2">
<![if !supportLists]><span style="font-family:"Calibri",sans-serif"><span style="mso-list:Ignore">-<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span dir="LTR"></span><b><i><span style="color:#2F5496"> Elena</span></i></b><o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </span><o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-left:72.0pt"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext"> Hal Finkel [<a href="mailto:hfinkel@anl.gov">mailto:hfinkel@anl.gov</a>]
<br>
<b>Sent:</b> Monday, January 15, 2018 20:34<br>
<b>To:</b> Demikhovsky, Elena <a href="mailto:elena.demikhovsky@intel.com"><elena.demikhovsky@intel.com></a>;
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>; Sanjay Patel (<a href="mailto:spatel@rotateright.com">spatel@rotateright.com</a>)
<a href="mailto:spatel@rotateright.com"><spatel@rotateright.com></a>; Chandler Carruth (<a href="mailto:chandlerc@gmail.com">chandlerc@gmail.com</a>)
<a href="mailto:chandlerc@gmail.com"><chandlerc@gmail.com></a>; Quentin Colombet (<a href="mailto:qcolombet@apple.com">qcolombet@apple.com</a>)
<a href="mailto:qcolombet@apple.com"><qcolombet@apple.com></a>; Craig Topper (<a href="mailto:craig.topper@gmail.com">craig.topper@gmail.com</a>)
<a href="mailto:craig.topper@gmail.com"><craig.topper@gmail.com></a><br>
<b>Cc:</b> Breger, Igor <a href="mailto:igor.breger@intel.com"><igor.breger@intel.com></a><br>
<b>Subject:</b> Re: GEP transformation by InstCombiner</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal" style="margin-left:72.0pt"> <o:p></o:p></p>
<p class="MsoNormal" style="margin-left:72.0pt"> <o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-left:72.0pt">On 01/15/2018 12:21 PM, Demikhovsky, Elena wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal" style="margin-left:72.0pt;text-indent:-17.85pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Hi all,</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt;text-indent:-17.85pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt;text-indent:-17.85pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">I’m working on an out-of-tree target and encountered the following problem:</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt;text-indent:-17.85pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt;text-indent:-17.85pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">InstCombiner “normalizes” GEPs and extends Index operand to the Pointer width.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt;text-indent:-17.85pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">It works fine if you can convert pointer to integer for address calculation and I assume that all registered targets do this.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt;text-indent:-17.85pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt;text-indent:-17.85pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">The target I’m working on has very restricted ISA for the pointer calculation:</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt;text-indent:-17.85pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">ptr + int, ptr - int, ptr - ptr and ptr-compare</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt;text-indent:-17.85pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt;text-indent:-17.85pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">I have full arithmetic set for 32-bit integers, but the Ptr is wider. Extending index to the Ptr width requires full arithmetic
support for pointers.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt;text-indent:-17.85pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">But, actually, it does not come from C-sources (casting Ptr to int means truncation).</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt;text-indent:-17.85pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt;text-indent:-17.85pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">I’d like to add TTI (TargetTransformInfo) to InstCombiner in order to configure the width of GEP indices.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt;text-indent:-17.85pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">The current default behavior will be preserved.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt;text-indent:-17.85pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">What do you think?</span><o:p></o:p></p>
</div>
</blockquote>
<p class="MsoNormal" style="margin-left:72.0pt"><br>
Given that this affects the canonical form of the IR, based on our current practice, it should go in DataLayout (not in TTI). InstCombine should probably know how to do the right thing for the IR even if the particular target is not compiled in.<br>
<br>
-Hal<br>
<br>
<br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal" style="margin-left:72.0pt;text-indent:-17.85pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt;text-indent:-17.85pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Thanks.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt;text-indent:-17.85pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span><o:p></o:p></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt;text-indent:-18.0pt;mso-list:l1 level1 lfo4">
<![if !supportLists]><span style="font-size:10.0pt;font-family:Symbol"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span dir="LTR"></span><b><i><span style="color:#2F5496">Elena</span></i></b><o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-left:72.0pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt;text-indent:-17.85pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt;text-indent:-17.85pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span><o:p></o:p></p>
</div>
<p style="margin-left:72.0pt">---------------------------------------------------------------------<br>
Intel Israel (74) Limited<o:p></o:p></p>
<p style="margin-left:72.0pt">This e-mail and any attachments may contain confidential material for<br>
the sole use of the intended recipient(s). Any review or distribution<br>
by others is strictly prohibited. If you are not the intended<br>
recipient, please contact the sender and delete all copies.<o:p></o:p></p>
</blockquote>
<p class="MsoNormal" style="margin-left:72.0pt"><br>
<br>
<br>
<o:p></o:p></p>
<pre style="margin-left:72.0pt">-- <o:p></o:p></pre>
<pre style="margin-left:72.0pt">Hal Finkel<o:p></o:p></pre>
<pre style="margin-left:72.0pt">Lead, Compiler Technology and Programming Languages<o:p></o:p></pre>
<pre style="margin-left:72.0pt">Leadership Computing Facility<o:p></o:p></pre>
<pre style="margin-left:72.0pt">Argonne National Laboratory<o:p></o:p></pre>
<p style="margin-left:36.0pt">---------------------------------------------------------------------<br>
Intel Israel (74) Limited<o:p></o:p></p>
<p style="margin-left:36.0pt">This e-mail and any attachments may contain confidential material for<br>
the sole use of the intended recipient(s). Any review or distribution<br>
by others is strictly prohibited. If you are not the intended<br>
recipient, please contact the sender and delete all copies.<o:p></o:p></p>
</blockquote>
<p class="MsoNormal" style="margin-left:36.0pt"><br>
<br>
<o:p></o:p></p>
<pre style="margin-left:36.0pt">-- <o:p></o:p></pre>
<pre style="margin-left:36.0pt">Hal Finkel<o:p></o:p></pre>
<pre style="margin-left:36.0pt">Lead, Compiler Technology and Programming Languages<o:p></o:p></pre>
<pre style="margin-left:36.0pt">Leadership Computing Facility<o:p></o:p></pre>
<pre style="margin-left:36.0pt">Argonne National Laboratory<o:p></o:p></pre>
</div>
<p>---------------------------------------------------------------------<br>
Intel Israel (74) Limited</p>
<p>This e-mail and any attachments may contain confidential material for<br>
the sole use of the intended recipient(s). Any review or distribution<br>
by others is strictly prohibited. If you are not the intended<br>
recipient, please contact the sender and delete all copies.</p></body>
</html>