<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 03/28/2014 12:01 PM, Jingyue Wu
wrote:<br>
</div>
<blockquote
cite="mid:CAMROOrFJg6HygnuBkwQAMjcVd-MkB62rdvspZirZBhBt3AR8Yg@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<div dir="ltr">
<div>Fixing PR19270. This issue is blocking a waiting patch of
mine that implements the optimization we discussed in <a
moz-do-not-send="true"
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>
</blockquote>
<br>
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.<br>
<br>
-Matt<br>
</body>
</html>