[OpaquePtr] Introduce option to force all pointers to be opaque pointers
authorArthur Eubanks <aeubanks@google.com>
Thu, 24 Jun 2021 15:21:24 +0000 (08:21 -0700)
committerArthur Eubanks <aeubanks@google.com>
Thu, 24 Jun 2021 20:32:31 +0000 (13:32 -0700)
commit4c8174f54b4ec3c6dac8ad446567174442bf3c29
tree9281ae145c45341685f74428987b7730b03818a8
parent7110510ecacf9eecc56d452e9ed3bf47fdee16a5
[OpaquePtr] Introduce option to force all pointers to be opaque pointers

We don't want to start updating tests to use opaque pointers until we're
close to the opaque pointer transition. However, before the transition
we want to run tests as if pointers are opaque pointers to see if there
are any crashes.

At some point when we have a flag to only create opaque pointers in the
bitcode and textual IR readers, and when we have fixed all places that
try to read a pointee type, this flag will be useless. However, until
then, this can help us find issues more easily.

Since the cl::opt is read into LLVMContext, we need to make sure
LLVMContext is created after cl::ParseCommandLineOptions().

Previously ValueEnumerator would visit the value types of global values
via the pointer type, but with opaque pointers we have to manually visit
the value type.

Reviewed By: nikic, dexonsmith

Differential Revision: https://reviews.llvm.org/D103503
llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
llvm/lib/IR/LLVMContextImpl.cpp
llvm/lib/IR/LLVMContextImpl.h
llvm/lib/IR/Type.cpp
llvm/test/Other/force-opaque-ptrs.ll [new file with mode: 0644]
llvm/tools/llvm-as/llvm-as.cpp
llvm/tools/llvm-dis/llvm-dis.cpp
llvm/tools/opt/opt.cpp