@@ -1674,43 +1674,6 @@ static Value *simplifyAndOrOfICmpsWithConstants(ICmpInst *Cmp0, ICmpInst *Cmp1,
1674
1674
return nullptr ;
1675
1675
}
1676
1676
1677
- static Value *simplifyAndOrOfICmpsWithZero (ICmpInst *Cmp0, ICmpInst *Cmp1,
1678
- bool IsAnd) {
1679
- ICmpInst::Predicate P0 = Cmp0->getPredicate (), P1 = Cmp1->getPredicate ();
1680
- if (!match (Cmp0->getOperand (1 ), m_Zero ()) ||
1681
- !match (Cmp1->getOperand (1 ), m_Zero ()) || P0 != P1)
1682
- return nullptr ;
1683
-
1684
- if ((IsAnd && P0 != ICmpInst::ICMP_NE) || (!IsAnd && P1 != ICmpInst::ICMP_EQ))
1685
- return nullptr ;
1686
-
1687
- // We have either "(X == 0 || Y == 0)" or "(X != 0 && Y != 0)".
1688
- Value *X = Cmp0->getOperand (0 );
1689
- Value *Y = Cmp1->getOperand (0 );
1690
-
1691
- // If one of the compares is a masked version of a (not) null check, then
1692
- // that compare implies the other, so we eliminate the other. Optionally, look
1693
- // through a pointer-to-int cast to match a null check of a pointer type.
1694
-
1695
- // (X == 0) || (([ptrtoint] X & ?) == 0) --> ([ptrtoint] X & ?) == 0
1696
- // (X == 0) || ((? & [ptrtoint] X) == 0) --> (? & [ptrtoint] X) == 0
1697
- // (X != 0) && (([ptrtoint] X & ?) != 0) --> ([ptrtoint] X & ?) != 0
1698
- // (X != 0) && ((? & [ptrtoint] X) != 0) --> (? & [ptrtoint] X) != 0
1699
- if (match (Y, m_c_And (m_Specific (X), m_Value ())) ||
1700
- match (Y, m_c_And (m_PtrToInt (m_Specific (X)), m_Value ())))
1701
- return Cmp1;
1702
-
1703
- // (([ptrtoint] Y & ?) == 0) || (Y == 0) --> ([ptrtoint] Y & ?) == 0
1704
- // ((? & [ptrtoint] Y) == 0) || (Y == 0) --> (? & [ptrtoint] Y) == 0
1705
- // (([ptrtoint] Y & ?) != 0) && (Y != 0) --> ([ptrtoint] Y & ?) != 0
1706
- // ((? & [ptrtoint] Y) != 0) && (Y != 0) --> (? & [ptrtoint] Y) != 0
1707
- if (match (X, m_c_And (m_Specific (Y), m_Value ())) ||
1708
- match (X, m_c_And (m_PtrToInt (m_Specific (Y)), m_Value ())))
1709
- return Cmp0;
1710
-
1711
- return nullptr ;
1712
- }
1713
-
1714
1677
static Value *simplifyAndOfICmpsWithAdd (ICmpInst *Op0, ICmpInst *Op1,
1715
1678
const InstrInfoQuery &IIQ) {
1716
1679
// (icmp (add V, C0), C1) & (icmp V, C0)
@@ -1789,9 +1752,6 @@ static Value *simplifyAndOfICmps(ICmpInst *Op0, ICmpInst *Op1,
1789
1752
if (Value *X = simplifyAndOrOfICmpsWithConstants (Op0, Op1, true ))
1790
1753
return X;
1791
1754
1792
- if (Value *X = simplifyAndOrOfICmpsWithZero (Op0, Op1, true ))
1793
- return X;
1794
-
1795
1755
if (Value *X = simplifyAndOrOfICmpsWithCtpop (Op0, Op1, true ))
1796
1756
return X;
1797
1757
if (Value *X = simplifyAndOrOfICmpsWithCtpop (Op1, Op0, true ))
@@ -1862,9 +1822,6 @@ static Value *simplifyOrOfICmps(ICmpInst *Op0, ICmpInst *Op1,
1862
1822
if (Value *X = simplifyAndOrOfICmpsWithConstants (Op0, Op1, false ))
1863
1823
return X;
1864
1824
1865
- if (Value *X = simplifyAndOrOfICmpsWithZero (Op0, Op1, false ))
1866
- return X;
1867
-
1868
1825
if (Value *X = simplifyAndOrOfICmpsWithCtpop (Op0, Op1, false ))
1869
1826
return X;
1870
1827
if (Value *X = simplifyAndOrOfICmpsWithCtpop (Op1, Op0, false ))
0 commit comments