<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">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>