[llvm] [IRBuilder] Propagate fast-math flags to folding in CreateBinOpFMF (PR #227543)
Jack Huang via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 29 19:58:22 PDT 2026
https://github.com/jackhong12 created https://github.com/llvm/llvm-project/pull/227543
Fast-math flags are used by InstSimplifyFolder, so we need to pass them to the folding function in CreateBinOpFMF.
>From 1c257aa79aab608a162d38cb7c966bfd452d42fb Mon Sep 17 00:00:00 2001
From: Jack Huang <jackhuang1205 at gmail.com>
Date: Wed, 30 Sep 2026 10:53:55 +0800
Subject: [PATCH] [IRBuilder] Propagate fast-math flags to folding in
CreateBinOpFMF
---
llvm/include/llvm/IR/IRBuilder.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/include/llvm/IR/IRBuilder.h b/llvm/include/llvm/IR/IRBuilder.h
index 359d491adeebd..10b62ebdc2949 100644
--- a/llvm/include/llvm/IR/IRBuilder.h
+++ b/llvm/include/llvm/IR/IRBuilder.h
@@ -1745,7 +1745,7 @@ class IRBuilderBase {
Value *CreateBinOpFMF(Instruction::BinaryOps Opc, Value *LHS, Value *RHS,
FMFSource FMFSource, const Twine &Name = "",
MDNode *FPMathTag = nullptr) {
- if (Value *V = Folder.FoldBinOp(Opc, LHS, RHS))
+ if (Value *V = Folder.FoldBinOpFMF(Opc, LHS, RHS, FMFSource.get(FMF)))
return V;
Instruction *BinOp = BinaryOperator::Create(Opc, LHS, RHS);
if (isa<FPMathOperator>(BinOp))
More information about the llvm-commits
mailing list