llvm.org GIT mirror llvm / ca3cf87
[ValueTracking] Use APInt::isNullValue/isOneValue which are more efficient for large APInts. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317712 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 2 years ago
1 changed file(s) with 6 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
41374137 // Is the sign bit set?
41384138 // (X (X >u MAXVAL) ? X : MAXVAL ==> UMAX
41394139 // (X (X >u MAXVAL) ? MAXVAL : X ==> UMIN
4140 if (Pred == CmpInst::ICMP_SLT && *C1 == 0 && C2->isMaxSignedValue())
4140 if (Pred == CmpInst::ICMP_SLT && C1->isNullValue() &&
4141 C2->isMaxSignedValue())
41414142 return {CmpLHS == TrueVal ? SPF_UMAX : SPF_UMIN, SPNB_NA, false};
41424143
41434144 // Is the sign bit clear?
42694270
42704271 // ABS(X) ==> (X >s 0) ? X : -X and (X >s -1) ? X : -X
42714272 // NABS(X) ==> (X >s 0) ? -X : X and (X >s -1) ? -X : X
4272 if (Pred == ICmpInst::ICMP_SGT && (*C1 == 0 || C1->isAllOnesValue())) {
4273 if (Pred == ICmpInst::ICMP_SGT &&
4274 (C1->isNullValue() || C1->isAllOnesValue())) {
42734275 return {(CmpLHS == TrueVal) ? SPF_ABS : SPF_NABS, SPNB_NA, false};
42744276 }
42754277
42764278 // ABS(X) ==> (X
42774279 // NABS(X) ==> (X
4278 if (Pred == ICmpInst::ICMP_SLT && (*C1 == 0 || *C1 == 1)) {
4280 if (Pred == ICmpInst::ICMP_SLT &&
4281 (C1->isNullValue() || C1->isOneValue())) {
42794282 return {(CmpLHS == FalseVal) ? SPF_ABS : SPF_NABS, SPNB_NA, false};
42804283 }
42814284 }