[llvm] [IR][DAG] Add support for `nneg` flag with `uitofp` (PR #86141)
Thorsten Schütt via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 21 12:39:20 PDT 2024
================
@@ -3882,7 +3882,15 @@ void SelectionDAGBuilder::visitUIToFP(const User &I) {
SDValue N = getValue(I.getOperand(0));
EVT DestVT = DAG.getTargetLoweringInfo().getValueType(DAG.getDataLayout(),
I.getType());
- setValue(&I, DAG.getNode(ISD::UINT_TO_FP, getCurSDLoc(), DestVT, N));
+ bool IsNonNeg = false;
+ if (auto *PNI = dyn_cast<PossiblyNonNegInst>(&I))
+ IsNonNeg = true;
+
+ unsigned Opc = ISD::UINT_TO_FP;
+ if (IsNonNeg && DAG.getTargetLoweringInfo().isSIToFPCheaperThanUIToFP(
----------------
tschuett wrote:
It should have been unary op.
https://github.com/llvm/llvm-project/pull/86141
More information about the llvm-commits
mailing list