[llvm] [GlobalISel] Add constant-folding of FP binops to combiner. (PR #65230)

Amara Emerson via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 6 21:35:15 PDT 2023


================
@@ -2645,6 +2645,14 @@ void CombinerHelper::replaceInstWithConstant(MachineInstr &MI, APInt C) {
   MI.eraseFromParent();
 }
 
+void CombinerHelper::replaceInstWithFConstant(MachineInstr &MI, ConstantFP *CFP) {
+  assert(MI.getNumDefs() == 1 && "Expected only one def?");
+  APFloat C = CFP->getValueAPF();
+  Builder.setInstr(MI);
----------------
aemerson wrote:

Agreed.

https://github.com/llvm/llvm-project/pull/65230


More information about the llvm-commits mailing list