[llvm] [AMDGPU][LibCallSimplify] Use target type's float-semantics in `ConstantFP::get` (PR #213721)

Steffen Larsen via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 6 01:04:49 PDT 2026


Juan Manuel Martinez =?utf-8?q?CaamaƱo?= <juamarti at amd.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/213721 at github.com>


================
@@ -2017,16 +2023,10 @@ bool AMDGPULibCalls::evaluateCall(CallInst *aCI, const FuncInfo &FInfo) {
     }
   }
 
-  Constant *nval0 = nullptr, *nval1 = nullptr;
-  if (FuncVecSize == 1) {
-    nval0 = ConstantFP::get(aCI->getType(), Val0[0]);
-    if (hasTwoResults)
-      nval1 = ConstantFP::get(aCI->getType(), Val1[0]);
-  } else {
-    nval0 = getConstantFloatVector(Val0, aCI->getType());
-    if (hasTwoResults)
-      nval1 = getConstantFloatVector(Val1, aCI->getType());
-  }
+  Constant *nval0 = getConstantFloat(Val0, aCI->getType());
+  Constant *nval1 = nullptr;
+  if (hasTwoResults)
+    nval1 = getConstantFloat(Val1, aCI->getType());
----------------
steffenlarsen wrote:

Nit; We could reduce this to a single assignment and maybe even make both of the pointers `const`?
```suggestion
  Constant *nval1 = hasTwoResults ? getConstantFloat(Val1, aCI->getType()) : nullptr;
```

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


More information about the llvm-commits mailing list