[llvm] [IRBuilder] Fold binary intrinsics (PR #80743)

Artem Tyurin via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 22 07:25:49 PST 2024


================
@@ -918,10 +918,11 @@ CallInst *IRBuilderBase::CreateUnaryIntrinsic(Intrinsic::ID ID, Value *V,
   return createCallHelper(Fn, {V}, Name, FMFSource);
 }
 
-CallInst *IRBuilderBase::CreateBinaryIntrinsic(Intrinsic::ID ID, Value *LHS,
-                                               Value *RHS,
-                                               Instruction *FMFSource,
-                                               const Twine &Name) {
+Value *IRBuilderBase::CreateBinaryIntrinsic(Intrinsic::ID ID, Value *LHS,
+                                            Value *RHS, Instruction *FMFSource,
+                                            const Twine &Name) {
+  if (auto *V = Folder.FoldBinaryIntrinsic(ID, LHS, RHS))
----------------
agentcooper wrote:

Makes sense, this is why `simplifyBinaryIntrinsic` has a `CallBase *Call` parameter.

I've updated the `Folder.FoldBinaryIntrinsic` signature.

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


More information about the llvm-commits mailing list