[llvm] [LLVM][InstSimplify] Refactor simplifyBinaryIntrinsic to remove Call operand. (PR #196309)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Fri May 8 06:15:24 PDT 2026


================
@@ -121,8 +121,10 @@ class LLVM_ABI InstSimplifyFolder final : public IRBuilderFolder {
 
   Value *FoldBinaryIntrinsic(Intrinsic::ID ID, Value *LHS, Value *RHS, Type *Ty,
                              Instruction *FMFSource = nullptr) const override {
-    return simplifyBinaryIntrinsic(ID, Ty, LHS, RHS, SQ,
-                                   dyn_cast_if_present<CallBase>(FMFSource));
+    FastMathFlags FMF;
+    if (auto *FPMO = dyn_cast_if_present<FPMathOperator>(FMFSource))
+      FMF = FPMO->getFastMathFlags();
----------------
paulwalker-arm wrote:

There's some interplay with ConstantFoldBinaryIntrinsic, which also looks to have the same unused operand but in its case seems to have code that implies it should be being use. I'll follow it up after I finished with simplifySelectWithFCmp.

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


More information about the llvm-commits mailing list