From 4db0c6937335f46f6752ef4afe102406fc9df626 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Thu, 20 Apr 2017 03:49:18 +0000 Subject: Recommit "[APInt] Add back the asserts that check that the APInt shift methods aren't called with values larger than BitWidth." This includes a fix to clamp a right shift of larger than BitWidth in DAG combining. llvm-svn: 300816 --- llvm/unittests/ADT/APIntTest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm/unittests/ADT/APIntTest.cpp') diff --git a/llvm/unittests/ADT/APIntTest.cpp b/llvm/unittests/ADT/APIntTest.cpp index 0f1d2d6d8f9..7d451836ad9 100644 --- a/llvm/unittests/ADT/APIntTest.cpp +++ b/llvm/unittests/ADT/APIntTest.cpp @@ -2021,7 +2021,7 @@ TEST(APIntTest, LogicalRightShift) { // Ensure we handle large shifts of multi-word. const APInt neg_one(128, static_cast(-1), true); - EXPECT_EQ(0, neg_one.lshr(257)); + EXPECT_EQ(0, neg_one.lshr(128)); } TEST(APIntTest, LeftShift) { @@ -2054,7 +2054,7 @@ TEST(APIntTest, LeftShift) { // Ensure we handle large shifts of multi-word. const APInt neg_one(128, static_cast(-1), true); - EXPECT_EQ(0, neg_one.shl(257)); + EXPECT_EQ(0, neg_one.shl(128)); } } // end anonymous namespace -- cgit v1.2.3