<div dir="ltr">Hi Matt, <div><br></div><div>That makes sense, and here's a more constructive patch. <div><br></div><div>Jingyue</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Mar 28, 2014 at 12:07 PM, Matt Arsenault <span dir="ltr"><<a href="mailto:Matthew.Arsenault@amd.com" target="_blank">Matthew.Arsenault@amd.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF"><div><div class="h5">
    <div>On 03/28/2014 12:01 PM, Jingyue Wu
      wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div>Fixing PR19270. This issue is blocking a waiting patch of
          mine that implements the optimization we discussed in <a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-March/071440.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-March/071440.html</a>. </div>

        <div><br>
        </div>
        visitGetElementPtr in InstructionCombining.cpp gets rid of
        unnecessary pointer casts in gep (cast X). However, this
        optimization may change the address space of the result pointer
        type, and cause type mismatch.
        <div>
          <br>
        </div>
        <div>e.g.,</div>
        <div>getelementptr [256 x float]* addrspacecast ([256 x float]
          addrspace(3)* @array to [256 x float]*), i64 0, i64 %i</div>
        <div>returns a float*, but the optimized instruction</div>
        <div>getelementptr [256 x float] addrspace(3)* @array, i64 0,
          i64 %i<br>
        </div>
        <div>returns a float addrspace(3)*</div>
        <div>
          <div>
            <div><br>
              <div>The attached patch disables this optimization when
                the address space of the source is different from that
                of the destination.</div>
            </div>
          </div>
        </div>
        <div>
          <br>
        </div>
        <div>Jingyue</div>
      </div>
    </blockquote>
    <br></div></div>
    If we're doing what I suggested and trying to do operations in the
    original address space, then instead of disabling this, why don't
    you make this instead just move the addrspacecast to after the GEP?
    Do the GEP in addrspace(3), and then addrspacecast that.<span class="HOEnZb"><font color="#888888"><br>
    <br>
    -Matt<br>
  </font></span></div>

</blockquote></div><br></div>