We already do this as a DAG combine. The version during lowering can only trigger if known bits changes something that improves known bits analysis. But this means we should be improving known bits analysis to work on the unlowered form instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319640
91177308-0d34-0410-b5e6-
96231b3b80d8
SDLoc dl(Op);
auto PtrVT = getPointerTy(DAG.getDataLayout());
- // Since UINT_TO_FP is legal (it's marked custom), dag combiner won't
- // optimize it to a SINT_TO_FP when the sign bit is known zero. Perform
- // the optimization here.
- if (DAG.SignBitIsZero(N0))
- return DAG.getNode(ISD::SINT_TO_FP, dl, Op.getValueType(), N0);
-
if (Op.getSimpleValueType().isVector())
return lowerUINT_TO_FP_vec(Op, DAG);