Fold conditional branches on constants away.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19360 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-01-07 22:49:57 +00:00
parent 4287d5e355
commit 5351e9b172

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);