From a83385fb7bdb325921d091729d95e2e1f4d49cc1 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 27 Apr 2006 05:01:07 +0000 Subject: [PATCH] Fix Regression/CodeGen/Generic/2006-04-26-SetCCAnd.ll and PR748. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27987 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 30 ++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index c26632a41e8..4809db47756 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -232,7 +232,22 @@ ISD::CondCode ISD::getSetCCAndOperation(ISD::CondCode Op1, ISD::CondCode Op2, return ISD::SETCC_INVALID; // Combine all of the condition bits. - return ISD::CondCode(Op1 & Op2); + ISD::CondCode Result = ISD::CondCode(Op1 & Op2); + + // Canonicalize illegal integer setcc's. + if (isInteger) { + switch (Result) { + default: break; + case ISD::SETUO: // e.g. SETUGT & SETULT + Result = ISD::SETFALSE; + break; + case ISD::SETUEQ: // e.g. SETUGE & SETULE + Result = ISD::SETEQ; + break; + } + } + + return Result; } const TargetMachine &SelectionDAG::getTarget() const { @@ -849,6 +864,19 @@ SDOperand SelectionDAG::SimplifySetCC(MVT::ValueType VT, SDOperand N1, case ISD::SETFALSE2: return getConstant(0, VT); case ISD::SETTRUE: case ISD::SETTRUE2: return getConstant(1, VT); + + case ISD::SETOEQ: + case ISD::SETOGT: + case ISD::SETOGE: + case ISD::SETOLT: + case ISD::SETOLE: + case ISD::SETONE: + case ISD::SETO: + case ISD::SETUO: + case ISD::SETUEQ: + case ISD::SETUNE: + assert(!MVT::isInteger(N1.getValueType()) && "Illegal setcc for integer!"); + break; } if (ConstantSDNode *N2C = dyn_cast(N2.Val)) {