[VNCoercion] Disallow coercion between different ni addrspaces
authorValentin Churavy <v.churavy@gmail.com>
Mon, 7 Dec 2020 21:13:57 +0000 (16:13 -0500)
committerValentin Churavy <v.churavy@gmail.com>
Tue, 8 Dec 2020 01:19:48 +0000 (20:19 -0500)
commit700cf7dcc927c0ffddc0a1acbfde490f673ffb4a
treeb09413bc40fb19a6b277b8e320de0a60ea52bdfc
parentefc063b621ea0c4d1e452bcade62f7fc7e1cc937
[VNCoercion] Disallow coercion between different ni addrspaces

I'm not sure if it would be legal by the IR reference to introduce
an addrspacecast here, since the IR reference is a bit vague on
the exact semantics, but at least for our usage of it (and I
suspect for many other's usage) it is not. For us, addrspacecasts
between non-integral address spaces carry frontend information that the
optimizer cannot deduce afterwards in a generic way (though we
have frontend specific passes in our pipline that do propagate
these). In any case, I'm sure nobody is using it this way at
the moment, since it would have introduced inttoptrs, which
are definitely illegal.

Fixes PR38375

Co-authored-by: Keno Fischer <keno@alumni.harvard.edu>
Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D50010
llvm/lib/Transforms/Utils/VNCoercion.cpp
llvm/test/Transforms/GVN/non-integral-pointers.ll