[llvm] [SimplifyCFG] Remove conservative fcmp guard from speculativelyExecuteBB (PR #211611)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 06:19:43 PDT 2026


================
@@ -3454,7 +3450,10 @@ bool SimplifyCFGOpt::speculativelyExecuteBB(CondBrInst *BI,
     Value *TrueV = ThenV, *FalseV = OrigV;
     if (Invert)
       std::swap(TrueV, FalseV);
-    Value *V = Builder.CreateSelect(BrCond, TrueV, FalseV, "spec.select", BI);
+    // Propagate fast-math flags from the phi node to the replacement select.
+    Value *V = Builder.CreateSelectFMF(BrCond, TrueV, FalseV,
+                                       isa<FPMathOperator>(PN) ? &PN : nullptr,
----------------
fhahn wrote:

```suggestion
                                       PN.getFastMathFlagsOrNone(),
```

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


More information about the llvm-commits mailing list