[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
================
@@ -3163,8 +3180,12 @@ static Constant *ConstantFoldScalarCall(StringRef Name,
if (Operands.size() == 1)
return ConstantFoldScalarCall1(Name, IntrinsicID, Ty, Operands, TLI, Call);
- if (Operands.size() == 2)
- return ConstantFoldScalarCall2(Name, IntrinsicID, Ty, Operands, TLI, Call);
+ if (Operands.size() == 2) {
+ if (auto *FoldedLibCall = ConstantFoldLibCall2(Name, Ty, Operands, TLI)) {
+ return FoldedLibCall;
+ }
----------------
dtcxzyw wrote:
```suggestion
if (Constant *FoldedLibCall = ConstantFoldLibCall2(Name, Ty, Operands, TLI))
return FoldedLibCall;
```
https://github.com/llvm/llvm-project/pull/80743
More information about the llvm-commits
mailing list