[InstSimplify] reduce code duplication for fmul folds; NFC
authorSanjay Patel <spatel@rotateright.com>
Mon, 3 Oct 2022 13:17:23 +0000 (09:17 -0400)
committerSanjay Patel <spatel@rotateright.com>
Mon, 3 Oct 2022 14:36:02 +0000 (10:36 -0400)
commit7b7940f9da80de6aa0b8f28a0ef809dafe4cdffc
tree71cfa2bcfc5f8ba8c67784a662d523f4858aa64b
parent4987ae84622b804e72c405aacbe297f0e5e247c7
[InstSimplify] reduce code duplication for fmul folds; NFC

The constant is already commuted for an fmul opcode,
but this code can be called more directly for fma,
so we have to swap for that caller. There are tests
in InstSimplify and InstCombine to verify that this
works as expected.
llvm/lib/Analysis/InstructionSimplify.cpp
llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll