summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-10-28 07:11:07 +0000
committerChris Lattner <sabre@nondot.org>2008-10-28 07:11:07 +0000
commit6e1c6231ba93ed7590c62ef0f94d0d9443b598ed (patch)
tree961807d92987e111aeb39e3d7235a0fe047b537c
parent7fe5e1812f5d018784d5186ccb31525665e61863 (diff)
downloadexternal_llvm-6e1c6231ba93ed7590c62ef0f94d0d9443b598ed.zip
external_llvm-6e1c6231ba93ed7590c62ef0f94d0d9443b598ed.tar.gz
external_llvm-6e1c6231ba93ed7590c62ef0f94d0d9443b598ed.tar.bz2
Don't produce invalid comparisons after legalize.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58320 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/SelectionDAG/DAGCombiner.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 0622c55..c6c8e03 100644
--- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/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);
}
}