Fold conditional branches on constants away.

llvm-svn: 19360
This commit is contained in:
Chris Lattner 2005-01-07 22:49:57 +00:00
parent cda3efa6e5
commit 5c66e45b92
1 changed files with 6 additions and 0 deletions

View File

@ -727,6 +727,12 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
}
break;
case ISD::BRCOND:
if (N2C)
if (N2C->getValue()) // Unconditional branch
return getNode(ISD::BR, MVT::Other, N1, N3);
else
return N1; // Never-taken branch
}
SDNode *N = new SDNode(Opcode, N1, N2, N3);