From 5fa104013001fd32b5753b32c9eba33d9c9229d9 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 28 Oct 2008 07:11:07 +0000 Subject: Don't produce invalid comparisons after legalize. llvm-svn: 58320 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp') diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 0622c552d5a..c6c8e0359b3 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -1720,7 +1720,8 @@ SDValue DAGCombiner::visitAND(SDNode *N) { if (LL == RL && LR == RR) { bool isInteger = LL.getValueType().isInteger(); ISD::CondCode Result = ISD::getSetCCAndOperation(Op0, Op1, isInteger); - if (Result != ISD::SETCC_INVALID) + if (Result != ISD::SETCC_INVALID && + (!AfterLegalize || TLI.isCondCodeLegal(Result, LL.getValueType()))) return DAG.getSetCC(N0.getValueType(), LL, LR, Result); } } @@ -1904,7 +1905,8 @@ SDValue DAGCombiner::visitOR(SDNode *N) { if (LL == RL && LR == RR) { bool isInteger = LL.getValueType().isInteger(); ISD::CondCode Result = ISD::getSetCCOrOperation(Op0, Op1, isInteger); - if (Result != ISD::SETCC_INVALID) + if (Result != ISD::SETCC_INVALID && + (!AfterLegalize || TLI.isCondCodeLegal(Result, LL.getValueType()))) return DAG.getSetCC(N0.getValueType(), LL, LR, Result); } } -- cgit v1.2.3