SelectionDAG::getBoolConstant was recently introduced. At the time I didn't know getConstTrueVal existed, but I think getBoolConstant is better as it will use the source VT to make sure it can properly detect floating point if it is configured differently.
llvm-svn: 324832
/// from getBooleanContents().
bool isConstFalseVal(const SDNode *N) const;
- /// Return a constant of type VT that contains a true value that respects
- /// getBooleanContents()
- SDValue getConstTrueVal(SelectionDAG &DAG, EVT VT, const SDLoc &DL) const;
-
/// Return if \p N is a True value when extended to \p VT.
bool isExtendedTrueVal(const ConstantSDNode *N, EVT VT, bool Signed) const;
// If the type of the setcc is larger (say, i8) then the value of the high
// bit depends on getBooleanContents(), so ask TLI for a real "true" value
// of the appropriate width.
- SDValue ExtTrueVal = (SetCCWidth == 1) ? DAG.getAllOnesConstant(DL, VT)
- : TLI.getConstTrueVal(DAG, VT, DL);
+ SDValue ExtTrueVal = (SetCCWidth == 1)
+ ? DAG.getAllOnesConstant(DL, VT)
+ : DAG.getBoolConstant(true, DL, VT, N00VT);
SDValue Zero = DAG.getConstant(0, DL, VT);
if (SDValue SCC =
SimplifySelectCC(DL, N00, N01, ExtTrueVal, Zero, CC, true))
llvm_unreachable("Invalid boolean contents");
}
-SDValue TargetLowering::getConstTrueVal(SelectionDAG &DAG, EVT VT,
- const SDLoc &DL) const {
- unsigned ElementWidth = VT.getScalarSizeInBits();
- APInt TrueInt =
- getBooleanContents(VT) == TargetLowering::ZeroOrOneBooleanContent
- ? APInt(ElementWidth, 1)
- : APInt::getAllOnesValue(ElementWidth);
- return DAG.getConstant(TrueInt, DL, VT);
-}
-
bool TargetLowering::isConstFalseVal(const SDNode *N) const {
if (!N)
return false;