summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-01-07 22:49:57 +0000
committerChris Lattner <sabre@nondot.org>2005-01-07 22:49:57 +0000
commit5c66e45b9218fc9abbcbffcc81a8f04365ae4d50 (patch)
tree1c4aa360d480ee9496b2d6b071c5b9747adac471
parentcda3efa6e514d2ae499617c506723d082f5cd7b0 (diff)
downloadbcm5719-llvm-5c66e45b9218fc9abbcbffcc81a8f04365ae4d50.tar.gz
bcm5719-llvm-5c66e45b9218fc9abbcbffcc81a8f04365ae4d50.zip
Fold conditional branches on constants away.
llvm-svn: 19360
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 6ab1d459575..e917350f8c9 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -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);
OpenPOWER on IntegriCloud