[llvm-branch-commits] [llvm] [Inline] Preserve nofpclass(inf) on returned selects (PR #244343)

Matt Arsenault via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Nov 20 13:51:29 PST 2026


================
@@ -1655,6 +1655,19 @@ static AttrBuilder IdentifyValidPoisonGeneratingAttributes(CallBase &CB) {
   return Valid;
 }
 
+// Preserve a no-infinity return constraint when the original call disappears.
+static void preserveNoInfReturn(CallBase &CB, ArrayRef<ReturnInst *> Returns) {
+  if ((CB.getRetNoFPClass() & fcInf) != fcInf)
+    return;
+
+  for (ReturnInst *RI : Returns) {
+    auto *SI = dyn_cast_if_present<SelectInst>(RI->getReturnValue());
+    if (SI && SI->getType()->isFloatingPointTy() && SI->hasOneUse() &&
----------------
arsenm wrote:

```suggestion
    auto *SI = dyn_cast<SelectInst>(RI->getReturnValue());
    if (SI && SI->hasOneUse() &&
```

This is implied by the return attribute 

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


More information about the llvm-branch-commits mailing list