From 5351e9b172962a4f51e6d3b12018dd2de34b2f97 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 7 Jan 2005 22:49:57 +0000 Subject: [PATCH] Fold conditional branches on constants away. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19360 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 6ab1d459575..e917350f8c9 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/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); -- 2.34.1