<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <br>
    <div class="moz-cite-prefix">On 01/15/2018 12:59 PM, Demikhovsky,
      Elena wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:A0DC88CEB3010344830D52D66533DA8E7E62F53D@LCSMSX154.ger.corp.intel.com">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <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;}
p.emailquote, li.emailquote, div.emailquote
        {mso-style-name:emailquote;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:1.0pt;
        border:none;
        padding:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:black;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Consolas",serif;
        color:black;}
span.EmailStyle21
        {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: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]-->
      <div class="WordSection1">
        <p class="MsoNormal"><a name="_MailEndCompose"
            moz-do-not-send="true"><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></a></p>
      </div>
    </blockquote>
    <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>
    <blockquote type="cite"
cite="mid:A0DC88CEB3010344830D52D66533DA8E7E62F53D@LCSMSX154.ger.corp.intel.com">
      <div class="WordSection1">
        <p class="MsoNormal"><a name="_MailEndCompose"
            moz-do-not-send="true"><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"><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" moz-do-not-send="true"></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 [<a class="moz-txt-link-freetext" 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 class="moz-txt-link-rfc2396E" href="mailto:elena.demikhovsky@intel.com"><elena.demikhovsky@intel.com></a>;
                <a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>; Sanjay Patel
                (<a class="moz-txt-link-abbreviated" href="mailto:spatel@rotateright.com">spatel@rotateright.com</a>) <a class="moz-txt-link-rfc2396E" href="mailto:spatel@rotateright.com"><spatel@rotateright.com></a>;
                Chandler Carruth (<a class="moz-txt-link-abbreviated" href="mailto:chandlerc@gmail.com">chandlerc@gmail.com</a>)
                <a class="moz-txt-link-rfc2396E" href="mailto:chandlerc@gmail.com"><chandlerc@gmail.com></a>; Quentin Colombet
                (<a class="moz-txt-link-abbreviated" href="mailto:qcolombet@apple.com">qcolombet@apple.com</a>) <a class="moz-txt-link-rfc2396E" href="mailto:qcolombet@apple.com"><qcolombet@apple.com></a>; Craig
                Topper (<a class="moz-txt-link-abbreviated" href="mailto:craig.topper@gmail.com">craig.topper@gmail.com</a>)
                <a class="moz-txt-link-rfc2396E" href="mailto:craig.topper@gmail.com"><craig.topper@gmail.com></a><br>
                <b>Cc:</b> Breger, Igor <a class="moz-txt-link-rfc2396E" href="mailto:igor.breger@intel.com"><igor.breger@intel.com></a><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: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:36.0pt;text-indent:-17.85pt"><span
                style="font-size:11.0pt;font-family:"Calibri",sans-serif">Hi
                all,<o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"
              style="margin-left:36.0pt;text-indent:-17.85pt"><span
                style="font-size:11.0pt;font-family:"Calibri",sans-serif"> <o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"
              style="margin-left:36.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:<o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"
              style="margin-left:36.0pt;text-indent:-17.85pt"><span
                style="font-size:11.0pt;font-family:"Calibri",sans-serif"> <o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"
              style="margin-left:36.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.<o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"
              style="margin-left:36.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.<o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"
              style="margin-left:36.0pt;text-indent:-17.85pt"><span
                style="font-size:11.0pt;font-family:"Calibri",sans-serif"> <o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"
              style="margin-left:36.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:<o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"
              style="margin-left:36.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<o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"
              style="margin-left:36.0pt;text-indent:-17.85pt"><span
                style="font-size:11.0pt;font-family:"Calibri",sans-serif"> <o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"
              style="margin-left:36.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.<o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"
              style="margin-left:36.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).<o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"
              style="margin-left:36.0pt;text-indent:-17.85pt"><span
                style="font-size:11.0pt;font-family:"Calibri",sans-serif"> <o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"
              style="margin-left:36.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.<o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"
              style="margin-left:36.0pt;text-indent:-17.85pt"><span
                style="font-size:11.0pt;font-family:"Calibri",sans-serif">The
                current default behavior will be preserved.<o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"
              style="margin-left:36.0pt;text-indent:-17.85pt"><span
                style="font-size:11.0pt;font-family:"Calibri",sans-serif">What
                do you think?<o:p></o:p></span></p>
          </div>
        </blockquote>
        <p class="MsoNormal" style="margin-left:36.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>
          <o:p></o:p></p>
        <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
          <div>
            <p class="MsoNormal"
              style="margin-left:36.0pt;text-indent:-17.85pt"><span
                style="font-size:11.0pt;font-family:"Calibri",sans-serif"> <o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"
              style="margin-left:36.0pt;text-indent:-17.85pt"><span
                style="font-size:11.0pt;font-family:"Calibri",sans-serif">Thanks.<o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"
              style="margin-left:36.0pt;text-indent:-17.85pt"><span
                style="font-size:11.0pt;font-family:"Calibri",sans-serif"> <o:p></o:p></span></p>
          </div>
          <p class="MsoNormal"
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:36.0pt;text-indent:-18.0pt;mso-list:l1
            level1 lfo1">
            <!--[if !supportLists]--><span
              style="font-size:10.0pt;font-family:Symbol;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</span></i></b><span
              style="color:#2F5496"><o:p></o:p></span></p>
          <div>
            <p class="MsoNormal" style="margin-left:36.0pt"><span
                style="font-size:11.0pt;font-family:"Calibri",sans-serif"> <o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"
              style="margin-left:36.0pt;text-indent:-17.85pt"><span
                style="font-size:11.0pt;font-family:"Calibri",sans-serif"> <o:p></o:p></span></p>
          </div>
          <div>
            <p class="MsoNormal"
              style="margin-left:36.0pt;text-indent:-17.85pt"><span
                style="font-size:11.0pt;font-family:"Calibri",sans-serif"> <o:p></o:p></span></p>
          </div>
          <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>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
  </body>
</html>