[llvm-dev] GEP with a null pointer base
Marcin Słowik via llvm-dev
llvm-dev at lists.llvm.org
Sun Jul 9 13:10:49 PDT 2017
Can we go back a little?
1) Add a new transformation to InstCombine that will replace 'getelementptr
> i8, i8* null, <ty> %n' with 'inttoptr <ty> %n to i8*' when <ty> has the
> same size as a pointer for the target architecture.
What's the actual problem with this approach? I personally find it the most
compelling - it is well-defined (well, somewhat), front-end agnostic (and
assume some front ends may find this kind of pointer arithmetic to be
well-defined) and predictable.
I would even extend it to allow offsets of different types to be used, with
additional zero-extension when applicable.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev