[llvm] [InstSimplify] Expose simplifyIntrinsic (NFC) (PR #202577)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 9 08:23:27 PDT 2026


================
@@ -194,16 +194,24 @@ LLVM_ABI Value *simplifyExtractElementInst(Value *Vec, Value *Idx,
 LLVM_ABI Value *simplifyCastInst(unsigned CastOpc, Value *Op, Type *Ty,
                                  const SimplifyQuery &Q);
 
+/// Given operands for a unary intrinsic, fold the result or return null.
+LLVM_ABI Value *simplifyUnaryIntrinsic(Intrinsic::ID IID, Value *Op0,
+                                       FastMathFlags FMF,
+                                       const SimplifyQuery &Q);
+
 /// Given operands for a binary intrinsic, fold the result or return null.
 LLVM_ABI Value *simplifyBinaryIntrinsic(Intrinsic::ID IID, Type *ReturnType,
                                         Value *Op0, Value *Op1,
                                         FastMathFlags FMF,
                                         const SimplifyQuery &Q);
 
-/// Given operands for a unary intrinsic, fold the result or return null.
-LLVM_ABI Value *simplifyUnaryIntrinsic(Intrinsic::ID IID, Value *Op0,
-                                       FastMathFlags FMF,
-                                       const SimplifyQuery &Q);
+/// Given operands for an intrinsic, fold the result or return null.
+LLVM_ABI Value *
+simplifyIntrinsic(Intrinsic::ID IID, Type *ReturnType, ArrayRef<Value *> Args,
+                  FastMathFlags FMF, const SimplifyQuery &Q,
+                  fp::ExceptionBehavior ExBehavior = fp::ebIgnore,
+                  RoundingMode Rounding = RoundingMode::NearestTiesToEven,
+                  Function *CxtF = nullptr);
----------------
nikic wrote:

nit: I'd order CxtF before the exception behavior / rounding mode.

I'd also add a comment that these arguments only apply to constrained FP intrinsics. (Just to make it clear that these are ignored for other FP intrinsics.)

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


More information about the llvm-commits mailing list