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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu May 7 06:33:13 PDT 2026


================
@@ -7133,12 +7130,16 @@ Value *llvm::simplifyBinaryIntrinsic(Intrinsic::ID IID, Type *ReturnType,
       MinMaxOptResult OptResult = MinMaxOptResult::CannotOptimize;
       Constant *NewConst = nullptr;
 
+      FastMathFlags FMF;
+      if (auto *FPMO = dyn_cast_if_present<FPMathOperator>(Q.CxtI))
----------------
nikic wrote:

> That's a shame. What context does CxtI represent?

It's the point in the program where the simplification must hold.

> I worried adding FastMathFlags flags through the call chain might be frowned upon because the data is not relevant for most of them? Is this a concern, where I should create dedicated functions or does it not matter?

Adding the argument to simplifyBinaryIntrinsic() should be fine, it's not exactly widely used.

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


More information about the llvm-commits mailing list