[llvm] [IR] Store fast-math flags in subclasses of Instruction (PR #191190)

Alexis Engelke via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 13 01:09:09 PDT 2026


================
@@ -4346,15 +4361,27 @@ GetElementPtrInst *GetElementPtrInst::cloneImpl() const {
 }
 
 UnaryOperator *UnaryOperator::cloneImpl() const {
-  return Create(getOpcode(), Op<0>());
+  auto *I = Create(getOpcode(), Op<0>());
+  I->FMFValue = FMFValue;
+  return I;
 }
 
 BinaryOperator *BinaryOperator::cloneImpl() const {
+  if (auto *I = dyn_cast<FPBinaryOperator>(this))
+    return I->cloneImpl();
----------------
aengelke wrote:

Only caller is Instruction, which should dispatch to FPBinaryOperator, so this should never be reached, assert instead.

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


More information about the llvm-commits mailing list