Loads should be able to look through invariant group intrinsics when
we're trying to constant fold.
This fixes some major code size regressions due to RTTI when
-fstrict-vtable-pointers is turned on.
Since invariant group intrinsics can't be constants,
ConstantFoldLoadFromConstPtr had to be changed to accept Values instead
of Constants. A majority of this patch is fixing up functions to work
with a Value instead of a Constant.
SymbolicallyEvaluateGEP has a new option to strip pointers specifically
for load constant folding. We can't strip all-zero GEPs since we walk
GlobalVariable constants using GEP indices, so introduce a new pointer
stripping type. We need this to simplify GEPs that have an operand that
derive from an invariant group intrinsic. Otherwise we can never see
that the GEP pointer operand could be a constant GlobalVariable.
The new pointer stripping mode also looks through local aliases to local
aliasees, fixing devirtualization with MSVC RTTI.
clang-tidy: warning: invalid case style for function 'ConstantFoldLoadFromValue' [readability-identifier-naming]
not useful