[LLVMdev] Moving towards a singular pointer type

Chris Lattner clattner at apple.com
Tue Feb 17 22:27:14 PST 2015


On Feb 17, 2015, at 1:58 PM, Chandler Carruth <chandlerc at gmail.com> wrote:
> I'm not actually worried about this change though Chris, at least w.r.t. optimizer changes being necessary. There are a few reasons:
> 
> 1) The old ScalarRepl pass cared a *lot* about pointer type, but the new SROA doesn't care at all, so the biggest offender is essentially handled.

Why do you think that SRoA is the biggest “offender”?  This will pretty fundamentally changing the shape of the IR (in a good way) by presumably eliminating a ton of bitcasts etc.  This has the potential to provoke instcombine regressions, tickle things like globalopt and load/store elimination, etc.  I don’t think that any of these will be particularly difficult to fix, but I imagine that there will be a long tail of minor things.

> 2) We've recently changed our pointer canonicalization rules several times and in different ways. Each of those changes helped shake out bugs where the optimizer was relying on the pointer type for something. The number of things found has dropped dramatically with each change, so I don't think there is a huge pile of problems left hiding somewhere.

This is more reassuring for me.

> 3) Almost all of the problems we found with the changes to canonicalization were actually cases where *casts* impeded optimizations, not the different pointer type. This change will be a strict reduction in the need for casts, and thus I expect it to actually be safer than the other changes. All evidence is that most of the remaining reliance on these kinds of things are actually relying on an absence of casts. With this change, the casts will all go away.

Yes, I like this change for a number of reasons: reduction of casts, simplified type resolution stuff in libIR, etc.

> So, I'm not as worried about having a very drawn out period of fixing the optimizer. I think we'll probably uncover a few minor things that we have to fix immediately, and then when we make the change some small number of benchmarks will regress (likely on some small number of platforms). We'll have to track those down, no doubt, but I'm not worried about it preventing progress for a long time.

So long as the regressions are tracked down and fixed before the mega-patch is landed, I’m ok with making this change.  I just think that finding any ways to make it more incremental and stage it will be very well rewarded.  It will be impossible to review the resultant patch otherwise.

-Chris



More information about the llvm-dev mailing list