<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 17, 2015 at 1:22 PM, Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com" target="_blank">clattner@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><span class="">On Feb 17, 2015, at 9:33 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<br><div><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><span><div><blockquote type="cite"><div><div dir="ltr">For some more detail: pointer types (i32*, %foo*, etc) complicate IR canonicalization. store + load should be the same instructions given the same number of bytes stored to memory, but instead we can have store float, store int, etc, etc. Another point Chandler made was that the bitcasts involved when a pointer isn't of the right type results in extra IR instructions we don't really need.<br><br>So the general idea is that all pointers would just be called "ptr" (pointer? void*?).<br><br>Is this something everyone feels is the right direction? Any reason why it wouldn't be?<br></div></div></blockquote></div><div><br></div></span><div>Hi David,</div><div><br></div><div>You can emulate this by having clang always generate "i8*” as the general type, then bitcast to "%Foo*” before doing a GEP.  Have you prototyped this change (with this approach, or any other one) to see what it does to the optimizers?</div></div></blockquote><div><br>No, I haven't tried prototyping it. It's a fair point, though I'm not sure how much of that work would be thrown out (some of it would be reusable - since it'll force the front end to track type information wehre it might've previously been relying on the IR types). Reckon it's worthwhile? (I can certainly see that side of it - throwing all this churn in when we don't quite know how it'll play out in the end seem risky, but it seemed like those who're invested in this stuff felt pretty certain it was the right way to go)<br></div></div></div></div></div></blockquote></div><br></span><div>You could say with more certainty, but I see this as an incremental way to move towards the singular pointer type model.  I suspect that there will be *some* impact on the optimizer, but that the optimizer can be taught how to handle it.  </div><div><br></div><div>If you go through the effort to build a huge patch that switches the universe over to a singular pointer type, you won’t be able to land it until the optimizer regressions are fixed.  This could be a very long time maintaining a large patch out of tree (never fun).</div></div></blockquote><div><br>Yeah, possibly - chatted about this a bit with Chandler too & his experience has been that shaking these sort of things out is often out-of-tree (granted, that's with small changes to the canonicalization of pointer types in specific places - this kind of widescale change might hit quite a few tests in-tree first before reaching the long-tail of random out-of-tree tests people run/care about) so having an out-of-tree patch won't necessarily get us far, and as you say - comes at a bit of a cost to maintain it out of tree and then transform it into the final version later once we introduce a true opaque pointer type.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>In the worst case, doing this could also expose an unforeseen problem with doing this.  I don’t expect that personally, but it is possible.<br></div></div></blockquote><div><br>Yeah, that's my personal concern just due to my unfamiliarity with this sort of thing - but I'm going to take everyone else's word for it that this is the preferred way forward & just keep pushing on with it. Sooner it can be in tree the sooner we'll have good coverage/results on it, I think. (& yeah, at various points we might have a few rounds on specific patches after they reveal perf regressions, but that seems fine - having everyone on the same code should make it easier to find/share reproductions, etc)<br><br>- David<br><br> </div></div></div></div>