Only insert an AND when converting from BR_COND to BRCC if needed.

llvm-svn: 25832
This commit is contained in:
Chris Lattner 2006-01-31 05:04:52 +00:00
parent 49467b6b5b
commit d33e8efd56

View File

@ -703,7 +703,9 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
} else {
// Make sure the condition is either zero or one. It may have been
// promoted from something else.
Tmp2 = DAG.getZeroExtendInReg(Tmp2, MVT::i1);
unsigned NumBits = MVT::getSizeInBits(Tmp2.getValueType());
if (!TLI.MaskedValueIsZero(Tmp2, (~0ULL >> (64-NumBits))^1))
Tmp2 = DAG.getZeroExtendInReg(Tmp2, MVT::i1);
Result = DAG.getNode(ISD::BR_CC, MVT::Other, Tmp1,
DAG.getCondCode(ISD::SETNE), Tmp2,