[OpaquePtr] Support changing load type in InstCombine
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 22 Jun 2021 15:20:44 +0000 (17:20 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 22 Jun 2021 19:16:15 +0000 (21:16 +0200)
commit7bb7fa12e73bd3c9fb66f05825758d729dd96ba5
tree7b91126efeef461866f7498c725900cdd2b65439
parent33c9438f116693b2f97c0c60376c32e0b8cb62f2
[OpaquePtr] Support changing load type in InstCombine

When the load type is changed to ptr, we need the load pointer type
to also be ptr, because it's not allowed to create a pointer to an
opaque pointer. This is achieved by adjusting the getPointerTo() API
to return an opaque pointer for an opaque pointer base type.

Differential Revision: https://reviews.llvm.org/D104718
llvm/include/llvm/IR/Type.h
llvm/lib/IR/Type.cpp
llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
llvm/test/Transforms/InstCombine/opaque-ptr.ll