reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced

Declarations

unittests/IR/ConstantRangeTest.cpp
   25   static ConstantRange Some;

References

unittests/IR/ConstantRangeTest.cpp
  173   EXPECT_FALSE(Some.isFullSet());
  174   EXPECT_FALSE(Some.isEmptySet());
  175   EXPECT_FALSE(Some.isWrappedSet());
  176   EXPECT_FALSE(Some.contains(APInt(16, 0x0)));
  177   EXPECT_FALSE(Some.contains(APInt(16, 0x9)));
  178   EXPECT_TRUE(Some.contains(APInt(16, 0xa)));
  179   EXPECT_TRUE(Some.contains(APInt(16, 0xaa9)));
  180   EXPECT_FALSE(Some.contains(APInt(16, 0xaaa)));
  196   EXPECT_EQ(Some, Some);
  196   EXPECT_EQ(Some, Some);
  200   EXPECT_NE(Full, Some);
  203   EXPECT_NE(Empty, Some);
  205   EXPECT_NE(One, Some);
  207   EXPECT_NE(Some, Wrap);
  217   EXPECT_EQ(Some.getSingleElement(), static_cast<APInt *>(nullptr));
  221   EXPECT_EQ(Some.getSingleMissingElement(), static_cast<APInt *>(nullptr));
  229   EXPECT_FALSE(Some.isSingleElement());
  236   EXPECT_EQ(Some.getUnsignedMax(), APInt(16, 0xaa9));
  241   EXPECT_EQ(Some.getUnsignedMin(), APInt(16, 0xa));
  246   EXPECT_EQ(Some.getSignedMax(), APInt(16, 0xaa9));
  251   EXPECT_EQ(Some.getSignedMin(), APInt(16, 0xa));
  263   EXPECT_FALSE(Some.isSignWrappedSet());
  280   EXPECT_FALSE(Some.isUpperWrapped());
  285   EXPECT_FALSE(Some.isUpperSignWrapped());
  302   ConstantRange TSome = Some.truncate(10);
  332   ConstantRange ZSome = Some.zeroExtend(20);
  338   EXPECT_EQ(ZSome, ConstantRange(Some.getLower().zext(20),
  339                                  Some.getUpper().zext(20)));
  351   ConstantRange SSome = Some.signExtend(20);
  358   EXPECT_EQ(SSome, ConstantRange(Some.getLower().sext(20),
  359                                  Some.getUpper().sext(20)));
  374   EXPECT_EQ(Empty.intersectWith(Some), Empty);
  377   EXPECT_EQ(Some.intersectWith(Some), Some);
  377   EXPECT_EQ(Some.intersectWith(Some), Some);
  377   EXPECT_EQ(Some.intersectWith(Some), Some);
  378   EXPECT_EQ(Some.intersectWith(One), One);
  380   EXPECT_EQ(Full.intersectWith(Some), Some);
  380   EXPECT_EQ(Full.intersectWith(Some), Some);
  381   EXPECT_EQ(Some.intersectWith(Wrap), Empty);
  584   EXPECT_EQ(Some.unionWith(Wrap), Full);
  618   EXPECT_EQ(Some.subtract(APInt(16, 4)),
  631   EXPECT_EQ(Full.add(Some), Full);
  635   EXPECT_EQ(Empty.add(Some), Empty);
  638   EXPECT_EQ(Some.add(APInt(16, 4)),
  761   EXPECT_EQ(Empty.addWithNoWrap(Some, OBO::NoSignedWrap), Empty);
  762   EXPECT_EQ(Some.addWithNoWrap(Empty, OBO::NoSignedWrap), Empty);
  764   EXPECT_NE(Full.addWithNoWrap(Some, OBO::NoSignedWrap), Full);
  765   EXPECT_NE(Some.addWithNoWrap(Full, OBO::NoSignedWrap), Full);
  816   EXPECT_EQ(Empty.addWithNoWrap(Some, OBO::NoUnsignedWrap), Empty);
  817   EXPECT_EQ(Some.addWithNoWrap(Empty, OBO::NoUnsignedWrap), Empty);
  819   EXPECT_NE(Full.addWithNoWrap(Some, OBO::NoUnsignedWrap), Full);
  820   EXPECT_NE(Some.addWithNoWrap(Full, OBO::NoUnsignedWrap), Full);
  907   EXPECT_EQ(Full.sub(Some), Full);
  911   EXPECT_EQ(Empty.sub(Some), Empty);
  914   EXPECT_EQ(Some.sub(APInt(16, 4)),
  916   EXPECT_EQ(Some.sub(Some),
  916   EXPECT_EQ(Some.sub(Some),
  928   EXPECT_EQ(Full.multiply(Some), Full);
  932   EXPECT_EQ(Empty.multiply(Some), Empty);
  936   EXPECT_EQ(One.multiply(Some), ConstantRange(APInt(16, 0xa*0xa),
  939   EXPECT_EQ(Some.multiply(Some), Full);
  939   EXPECT_EQ(Some.multiply(Some), Full);
  940   EXPECT_EQ(Some.multiply(Wrap), Full);
  945   EXPECT_EQ(Zero.multiply(Some), Zero);
  948   EXPECT_EQ(Some.multiply(Zero), Zero);
  972   EXPECT_EQ(Full.umax(Some), ConstantRange(APInt(16, 0xa), APInt(16, 0)));
  974   EXPECT_EQ(Full.umax(Some), ConstantRange(APInt(16, 0xa), APInt(16, 0)));
  976   EXPECT_EQ(Empty.umax(Some), Empty);
  979   EXPECT_EQ(Some.umax(Some), Some);
  979   EXPECT_EQ(Some.umax(Some), Some);
  979   EXPECT_EQ(Some.umax(Some), Some);
  980   EXPECT_EQ(Some.umax(Wrap), ConstantRange(APInt(16, 0xa), APInt(16, 0)));
  981   EXPECT_EQ(Some.umax(One), Some);
  981   EXPECT_EQ(Some.umax(One), Some);
  991   EXPECT_EQ(Full.smax(Some), ConstantRange(APInt(16, 0xa),
  997   EXPECT_EQ(Empty.smax(Some), Empty);
 1000   EXPECT_EQ(Some.smax(Some), Some);
 1000   EXPECT_EQ(Some.smax(Some), Some);
 1000   EXPECT_EQ(Some.smax(Some), Some);
 1001   EXPECT_EQ(Some.smax(Wrap), ConstantRange(APInt(16, 0xa),
 1003   EXPECT_EQ(Some.smax(One), Some);
 1003   EXPECT_EQ(Some.smax(One), Some);
 1012   EXPECT_EQ(Full.umin(Some), ConstantRange(APInt(16, 0), APInt(16, 0xaaa)));
 1015   EXPECT_EQ(Empty.umin(Some), Empty);
 1018   EXPECT_EQ(Some.umin(Some), Some);
 1018   EXPECT_EQ(Some.umin(Some), Some);
 1018   EXPECT_EQ(Some.umin(Some), Some);
 1019   EXPECT_EQ(Some.umin(Wrap), ConstantRange(APInt(16, 0), APInt(16, 0xaaa)));
 1020   EXPECT_EQ(Some.umin(One), One);
 1030   EXPECT_EQ(Full.smin(Some), ConstantRange(APInt(16, (uint64_t)INT16_MIN),
 1034   EXPECT_EQ(Empty.smin(Some), Empty);
 1037   EXPECT_EQ(Some.smin(Some), Some);
 1037   EXPECT_EQ(Some.smin(Some), Some);
 1037   EXPECT_EQ(Some.smin(Some), Some);
 1038   EXPECT_EQ(Some.smin(Wrap), ConstantRange(APInt(16, (uint64_t)INT16_MIN),
 1040   EXPECT_EQ(Some.smin(One), One);
 1053   EXPECT_EQ(Full.udiv(Some), ConstantRange(APInt(16, 0),
 1058   EXPECT_EQ(Empty.udiv(Some), Empty);
 1061   EXPECT_EQ(One.udiv(Some), ConstantRange(APInt(16, 0), APInt(16, 2)));
 1063   EXPECT_EQ(Some.udiv(Some), ConstantRange(APInt(16, 0), APInt(16, 0x111)));
 1063   EXPECT_EQ(Some.udiv(Some), ConstantRange(APInt(16, 0), APInt(16, 0x111)));
 1064   EXPECT_EQ(Some.udiv(Wrap), ConstantRange(APInt(16, 0), APInt(16, 0xaaa)));
 1250   EXPECT_EQ(Full.shl(Some), Full);   // TODO: [0, (-1 << 0xa) + 1)
 1254   EXPECT_EQ(Empty.shl(Some), Empty);
 1258   EXPECT_EQ(One.shl(Some), Full);    // TODO: [0xa << 0xa, 0)
 1260   EXPECT_EQ(Some.shl(Some), Full);   // TODO: [0xa << 0xa, 0xfc01)
 1260   EXPECT_EQ(Some.shl(Some), Full);   // TODO: [0xa << 0xa, 0xfc01)
 1261   EXPECT_EQ(Some.shl(Wrap), Full);   // TODO: [0xa, 0x7ff << 0x5 + 1)
 1274   EXPECT_EQ(Full.lshr(Some), ConstantRange(APInt(16, 0),
 1279   EXPECT_EQ(Empty.lshr(Some), Empty);
 1282   EXPECT_EQ(One.lshr(Some), ConstantRange(APInt(16, 0)));
 1284   EXPECT_EQ(Some.lshr(Some), ConstantRange(APInt(16, 0),
 1284   EXPECT_EQ(Some.lshr(Some), ConstantRange(APInt(16, 0),
 1286   EXPECT_EQ(Some.lshr(Wrap), ConstantRange(APInt(16, 0), APInt(16, 0xaaa)));
 1298   EXPECT_EQ(Full.ashr(Some), ConstantRange(APInt(16, 0xffe0),
 1303   EXPECT_EQ(Empty.ashr(Some), Empty);
 1306   EXPECT_EQ(One.ashr(Some), ConstantRange(APInt(16, 0)));
 1308   EXPECT_EQ(Some.ashr(Some), ConstantRange(APInt(16, 0),
 1308   EXPECT_EQ(Some.ashr(Some), ConstantRange(APInt(16, 0),
 1310   EXPECT_EQ(Some.ashr(Wrap), ConstantRange(APInt(16, 0), APInt(16, 0xaaa)));
 1785   EXPECT_MAY_OVERFLOW(Some.unsignedAddMayOverflow(Empty));
 1786   EXPECT_MAY_OVERFLOW(Empty.unsignedAddMayOverflow(Some));
 1819   EXPECT_MAY_OVERFLOW(Some.unsignedSubMayOverflow(Empty));
 1820   EXPECT_MAY_OVERFLOW(Empty.unsignedSubMayOverflow(Some));
 1854   EXPECT_MAY_OVERFLOW(Some.signedAddMayOverflow(Empty));
 1855   EXPECT_MAY_OVERFLOW(Empty.signedAddMayOverflow(Some));
 1906   EXPECT_MAY_OVERFLOW(Some.signedSubMayOverflow(Empty));
 1907   EXPECT_MAY_OVERFLOW(Empty.signedSubMayOverflow(Some));