Templatize parts of VNCoercion, and add constant-only versions of the functions to be used in NewGVN.
This is ground work for the changes to enable coercion in NewGVN.
GVN doesn't care if they end up constant because it eliminates as it goes.
IRBuilder and ConstantFolder deliberately present the same interface,
so we use this to our advantage to templatize our functions to make
them either constant only or not.
Subscribers: llvm-commits, Prazek
Differential Revision: https://reviews.llvm.org/D30928