[VNCoercion] Use ConstantFoldLoadFromConst API (NFCI)
authorNikita Popov <npopov@redhat.com>
Thu, 30 Jun 2022 12:49:44 +0000 (14:49 +0200)
committerNikita Popov <npopov@redhat.com>
Thu, 30 Jun 2022 12:52:27 +0000 (14:52 +0200)
commit014c4bdb9d29ad82dc983c1fc9822585b2def842
tree3f88ebbc3a68b8ce2a61da7e6c05ef9bcf4f23e7
parent007934343c4c18102b2b3e4195d356dbcdf9a3fc
[VNCoercion] Use ConstantFoldLoadFromConst API (NFCI)

Nowdays we have a generic constant folding API to load a type from
an offset. It should be able to do anything that VNCoercion can do.

This avoids the weird templating between IRBuilder and ConstantFolder
in one function, which is will stop working as the IRBuilderFolder
moves from CreateXYZ to FoldXYZ APIs.

Unfortunately, this doesn't eliminate this pattern from VNCoercion
entirely yet.
llvm/lib/Transforms/Scalar/NewGVN.cpp
llvm/lib/Transforms/Utils/VNCoercion.cpp