<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On May 29, 2015, at 10:42 AM, Matt Arsenault <<a href="mailto:arsenm2@gmail.com" class="">arsenm2@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On May 29, 2015, at 10:25 AM, Fiona <<a href="mailto:escha@apple.com" class="">escha@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><span class="Apple-converted-space"> </span>On an out of tree target, the shift type is i64 (because that's the pointer type, and pre-legalization, shifts are created with shift type == pointer type).<span class="Apple-converted-space"> </span></span></div></blockquote></div><br class=""><div class="">Shifts should be using TLI::getShiftAmountTy() during SelectionDAGBuilder, so not ever the pointer type. Are you not overriding that?</div></div></div></blockquote></div><div class=""><br class=""></div><div class="">The shift in question is created by the DAGCombiner, here:</div><br class=""><div class=""><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">      <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">SDValue</span> Shift = <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">DAG</span>.<span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">getNode</span>(<span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ISD</span>::<span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">SRA</span>, DL, XType,</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">                                  N0,</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">                                  <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">DAG</span>.<span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">getConstant</span>(XType.<span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">getSizeInBits</span>() - <span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">1</span>, DL,</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">                                         <span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">getShiftAmountTy</span>(N0.<span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">getValueType</span>())));</div></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">getShiftAmountTy, also in the DAGCombiner, does this:</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><div style="margin: 0px; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">    </span>/// Returns a type large enough to hold any valid shift amount - before type</div><div style="margin: 0px; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">    </span>/// legalization these can be huge.</div><div style="margin: 0px;" class="">    <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">EVT</span> getShiftAmountTy(<span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">EVT</span> LHSTy) {</div><div style="margin: 0px; color: rgb(209, 47, 27);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">      </span><span style="font-variant-ligatures: no-common-ligatures; color: #78492a" class="">assert</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(LHSTy.</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">isInteger</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">() && </span>"Shift amount is not an integer type!"<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">);</span></div><div style="margin: 0px;" class="">      <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">if</span> (LHSTy.<span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">isVector</span>())</div><div style="margin: 0px;" class="">        <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">return</span> LHSTy;</div><div style="margin: 0px; color: rgb(49, 89, 93);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">      </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">return</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">LegalTypes</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> ? </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">TLI</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">.</span>getScalarShiftAmountTy<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(LHSTy)</span></div><div style="margin: 0px;" class="">                        : <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">TLI</span>.<span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">getPointerTy</span>();</div><div style="margin: 0px;" class="">    }</div><div style="margin: 0px;" class=""><br class=""></div><div style="margin: 0px;" class="">Note how it uses PointerTy prior to legalization.</div><div style="margin: 0px;" class=""><br class=""></div><div style="margin: 0px;" class="">—escha</div></div></body></html>