[LLVMdev] Semantics of an Inbounds GetElementPtr

Nicholas White n.j.white at gmail.com
Sat May 9 06:35:42 PDT 2015


Thanks - that was very interesting. I've had a go at implementing it
here - http://reviews.llvm.org/D9634 - as an improvement to the SCCP
pass. It seems to work (see the test cases), but I had to make a few
compromises (making PtrUseVisitor look through phi nodes, only working
on CmpInst.isEquality() instructions, and making the SCCP pass
dependent on the PostDominatorTree pass). I think it's O(n);
PtrUseVisitor scans each Use at most once, and PostDominatorTree seems
linear in the number of predecessor blocks. It was easier to implement
by starting at a ptr-vs-null-checking CmpInst and analysing the code
forwards rather than by starting at an inbounds GEP instruction and
analysing the code backwards. What do you think?

Thanks -

Nick



More information about the llvm-dev mailing list