<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 Nov 30, 2021, at 04:51, Renato Golin <<a href="mailto:rengolin@gmail.com" class="">rengolin@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div dir="ltr" class="">On Mon, 29 Nov 2021 at 18:15, Matt Arsenault <<a href="mailto:arsenm2@gmail.com" target="_blank" class="">arsenm2@gmail.com</a>> wrote:<br class=""></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class=""><div class=""><div class="">This is true, but this isn’t directly related to this change. If the target does not have no-op conversions between a given pair of address spaces, the original code was broken to begin with. This change does not allow introducing new illegal address space conversions that were not already present in the original program. It’s garbage in, garbage out. If the target can’t really reinterpret these pointers, it would be UB on access.</div></div></div></blockquote><div class=""><br class=""></div><div class="">Ah, I see.</div><div class=""><br class=""></div><div class="">So IIUC, adding the casts in the first place would have to know about target address spaces, but this specific change only allows eliding the inttoptr cast in the specific case where the address spaces have the same data layout?</div><div class=""><br class=""></div><div class="">Assuming the initial cast was legal to begin with, this looks sensible to me.</div></div></div></div></blockquote><div>The target’s notion of address space casts doesn’t apply here. The user decided to reinterpret the pointer in a different address space, which may or may not be valid to use on the target.</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_quote"><div class=""><br class=""></div><div class="">I was worried this would allow (encourage?) front-ends and other passes to add an address space cast where none (could have) existed in the first place.</div></div></div></div></blockquote><div><br class=""></div><div>No, we’re converting from an in-memory representation of reinterpreting bits to one in values. Frontends still need to have some contextual knowledge of what the language and target expects out of address spaces. </div><div><br class=""></div></div><div class="">-Matt</div></body></html>