[llvm-branch-commits] [llvm] [DAGCombiner] Mark uint_to_fp widened through trunc nuw as nneg (PR #242916)
Dmitry Sidorov via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Nov 16 01:57:43 PST 2026
================
@@ -21009,10 +21009,13 @@ SDValue DAGCombiner::visitUINT_TO_FP(SDNode *N) {
return DAG.getNode(ISD::UINT_TO_FP, DL, VT, Trunc);
}
- // fold (uint_to_fp (trunc nuw x)) -> (uint_to_fp x)
+ // fold (uint_to_fp (trunc nuw x)) -> (uint_to_fp nneg x)
if (N0.getOpcode() == ISD::TRUNCATE && N0->getFlags().hasNoUnsignedWrap() &&
- TLI.isTypeDesirableForOp(N, N0.getOperand(0).getValueType()))
- return DAG.getNode(ISD::UINT_TO_FP, DL, VT, N0.getOperand(0));
+ TLI.isTypeDesirableForOp(N, N0.getOperand(0).getValueType())) {
+ SDNodeFlags Flags = N->getFlags();
+ Flags.setNonNeg(true);
+ return DAG.getNode(ISD::UINT_TO_FP, DL, VT, N0.getOperand(0), Flags);
----------------
MrSidims wrote:
Indeed, applied
https://github.com/llvm/llvm-project/pull/242916
More information about the llvm-branch-commits
mailing list