<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jun 10, 2019, at 9:43 PM, via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 12px;" class=""><div class="">The following combine(-enabling transformation) makes me uncomfortable:</div><div class=""><br class=""></div><div class=""> gep(addrspacecast(gep p0) to p1)</div><div class=""><br class=""></div><div class=""> addrspacecast(gep(gep p0)) to p1</div><div class=""><br class=""></div><div class="">It's applied at visitAddrSpaceCast in InstCombineCasts.cpp.</div><div class=""><br class=""></div><div class="">Before this, I'd always assumed address spaces were very much "user domain". Datalayout even supports marking a space as "non-integral", to designate that manipulation as bits is impossible. In my case, I have a different byte width in p1 over p0 (I know - but we all knew it was coming). All of p0 can be addressed in p1, but the reverse transformation is only sometimes possible as GEPs behave differently on the other side of the cast. This transformation of course breaks that.</div></div></div></blockquote><div><br class=""></div>What do you mean exactly by "behave differently on the other side of the cast”? Do you have a concrete example?</div><div><br class=""></div><div>Questions about what’s allowed with addrspacecast arithmetic have come up before (e.g. <a href="https://reviews.llvm.org/D31924" class="">https://reviews.llvm.org/D31924</a>) but it’s never really converged into explicit guidance for the LangRef. Is this with a non-integral address space? I would like to make the LangRef clearer on what’s allowed and what’s not. Having some concrete examples would be helpful to clarify this, and possibly remove the combine.<div><br class=""></div><div>-Matt</div><div><br class=""></div></div><br class=""></body></html>