From 0280621b31265836ceceaa56c7e87ee41e9f2684 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Mon, 11 Mar 2019 17:56:18 +0000 Subject: [PATCH] [DAG] FoldSetCC - reuse valuetype + ensure its simple. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355847 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index d91d9d6b991..a87883bbe40 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -1970,7 +1970,7 @@ SDValue SelectionDAG::FoldSetCC(EVT VT, SDValue N1, SDValue N2, case ISD::SETUO: case ISD::SETUEQ: case ISD::SETUNE: - assert(!N1.getValueType().isInteger() && "Illegal setcc for integer!"); + assert(!OpVT.isInteger() && "Illegal setcc for integer!"); break; } @@ -2054,11 +2054,10 @@ SDValue SelectionDAG::FoldSetCC(EVT VT, SDValue N1, SDValue N2, case ISD::SETUGE: return getBoolConstant(R!=APFloat::cmpLessThan, dl, VT, OpVT); } - } else if (N1CFP) { + } else if (N1CFP && OpVT.isSimple()) { // Ensure that the constant occurs on the RHS. ISD::CondCode SwappedCond = ISD::getSetCCSwappedOperands(Cond); - MVT CompVT = N1.getValueType().getSimpleVT(); - if (!TLI->isCondCodeLegal(SwappedCond, CompVT)) + if (!TLI->isCondCodeLegal(SwappedCond, OpVT.getSimpleVT())) return SDValue(); return getSetCC(dl, VT, N2, N1, SwappedCond); } else if (N2CFP && N2CFP->getValueAPF().isNaN()) { -- 2.50.1