[llvm-dev] Is it valid to dereference a pointer that have undef bits in its offset?

Juneyoung Lee via llvm-dev llvm-dev at lists.llvm.org
Sun Sep 20 15:47:09 PDT 2020


Hello all,

Is it valid to dereference a pointer that has undef bits in its offset?

For example,

%p = alloca [8 x i8]
%p2 = gep %p, (undef & 8)
store 0, %p2

undef & 8 is always less than 8, so technically it will store zero to one
of the array's elements.

The reason is that I want to improve no-undef analysis by suggesting that a
pointer that is passed to load/store is well-defined, by making it raise UB
when a pointer with undef bits is given.

A suggested patch is here: https://reviews.llvm.org/D87994

I wonder whether there is a case using this to do something that I'm not
aware.

Thanks,
Juneyoung
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200921/9a03c974/attachment.html>


More information about the llvm-dev mailing list