[MergeFunctions] Intersect poison-generating flags (#220015)
Instead of comparing the flags in FunctionComparator, intersect them in
MergeFunctions. This both a) fixes miscompiles where we failed to check
the poison flags for GEP and FMF and b) allows more function merging, in
cases where the functions only differ in flags.
This can be extended to combine instruction-level metadata as well in
the future.
Fixes https://github.com/llvm/llvm-project/issues/219664.