[LLVMdev] RFC: GEP as canonical form for pointer addressing

Philip Reames listmail at philipreames.com
Mon Feb 24 15:19:37 PST 2014


On 02/20/2014 01:02 AM, David Chisnall wrote:
> We have managed to get LLVM working (and building nontrivial amounts of code) on a MIPS-derived architecture that has non-integer pointers, and the representation in the IR itself is fine.  We have a few hacks in optimisations that are far too coarse grained (i.e. don't do this optimisation if you're dealing with this kind of pointer, even though many of them [SCEV in particular] should work but the code makes invalid assumptions).  We do end up having to add more after every merge.
Any chance you'd be willing to share patches?  Or even just a list of 
optimizations effected?  This is work I'm likely be duplicating in the 
very near future.
> We start to hit problems when we get to SelectionDAG, which makes a lot of assumptions about the underlying architecture and has an annoying habit of thinking it knows better than the back end and undoing transformations that the back end has done.
We looked at trying to preserve pointer vs integer information post 
SelectionDAG and quickly gave up.  I believe this to be the right long 
term direction - i.e. years from now - but we didn't believe it would be 
viable in the near term.  Instead, we've chosen to encode the 
information we actually need - which values to rewrite - at an earlier 
phase and construct the IR such that - we hope - nothing can insert uses 
after our insert safepoints.

The fact you've gotten this working all the way though is an impressive 
accomplishment and gives me hope for the long term direction.

Philip



More information about the llvm-dev mailing list