[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


================
@@ -2564,36 +2625,38 @@ static Constant *ConstantFoldScalarCall2(StringRef Name,
         return nullptr;
       const APFloat &Op2V = Op2->getValueAPF();
 
-      if (const auto *ConstrIntr = dyn_cast<ConstrainedFPIntrinsic>(Call)) {
-        RoundingMode RM = getEvaluationRoundingMode(ConstrIntr);
-        APFloat Res = Op1V;
-        APFloat::opStatus St;
-        switch (IntrinsicID) {
-        default:
+      if (Call) {
+        if (const auto *ConstrIntr = dyn_cast<ConstrainedFPIntrinsic>(Call)) {
----------------
dtcxzyw wrote:

```suggestion
    if (const auto *ConstrIntr = dyn_cast_if_present<ConstrainedFPIntrinsic>(Call)) {
```

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


More information about the llvm-commits mailing list