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

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 22 08:01:38 PST 2024


================
@@ -1735,3 +1735,30 @@ Constant *llvm::ConstantFoldGetElementPtr(Type *PointeeTy, Constant *C,
 
   return nullptr;
 }
+
+Constant *llvm::ConstantFoldBinaryIntrinsicInstruction(Intrinsic::ID ID,
+                                                       Constant *LHS,
+                                                       Constant *RHS,
+                                                       Type *Ty) {
+  auto *LC = dyn_cast<ConstantFP>(LHS);
----------------
dtcxzyw wrote:

```suggestion
  ConstantFP *LC = dyn_cast<ConstantFP>(LHS);
```

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


More information about the llvm-commits mailing list