diff options
author | Michael Kuperstein <mkuper@google.com> | 2016-09-01 23:02:32 +0000 |
---|---|---|
committer | Michael Kuperstein <mkuper@google.com> | 2016-09-01 23:02:32 +0000 |
commit | 7bc54cebeab437eaeb5fb39c876f9d24e38f6f52 (patch) | |
tree | e5304e1a4b9f8eebd96aa0bc287f9072175d2a89 /llvm/lib/CodeGen | |
parent | 8a425f03dd83841b9993953c07accfde7e423915 (diff) | |
download | bcm5719-llvm-7bc54cebeab437eaeb5fb39c876f9d24e38f6f52.tar.gz bcm5719-llvm-7bc54cebeab437eaeb5fb39c876f9d24e38f6f52.zip |
[Legalizer] Don't throw away false low half when expanding GT/LT SETCC
When expanding a SETCC for which the low half is known to evaluate to false,
we can only throw it away for LT/GT comparisons, not LE/GE.
This fixes PR29170.
Differential Revision: https://reviews.llvm.org/D24151
llvm-svn: 280424
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp index 47be5f28fe0..5b1fbbba8d9 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp @@ -2865,16 +2865,16 @@ void DAGTypeLegalizer::IntegerExpandSetCCOperands(SDValue &NewLHS, ConstantSDNode *LoCmpC = dyn_cast<ConstantSDNode>(LoCmp.getNode()); ConstantSDNode *HiCmpC = dyn_cast<ConstantSDNode>(HiCmp.getNode()); - if ((LoCmpC && LoCmpC->isNullValue()) || - (HiCmpC && HiCmpC->isNullValue() && - (CCCode == ISD::SETLE || CCCode == ISD::SETGE || CCCode == ISD::SETUGE || - CCCode == ISD::SETULE)) || - (HiCmpC && HiCmpC->getAPIntValue() == 1 && - (CCCode == ISD::SETLT || CCCode == ISD::SETGT || CCCode == ISD::SETUGT || - CCCode == ISD::SETULT))) { - // low part is known false, returns high part. + + bool EqAllowed = (CCCode == ISD::SETLE || CCCode == ISD::SETGE || + CCCode == ISD::SETUGE || CCCode == ISD::SETULE); + + if ((EqAllowed && (HiCmpC && HiCmpC->isNullValue())) || + (!EqAllowed && ((HiCmpC && (HiCmpC->getAPIntValue() == 1)) || + (LoCmpC && LoCmpC->isNullValue())))) { // For LE / GE, if high part is known false, ignore the low part. - // For LT / GT, if high part is known true, ignore the low part. + // For LT / GT: if low part is known false, return the high part. + // if high part is known true, ignore the low part. NewLHS = HiCmp; NewRHS = SDValue(); return; |