@@ -13,21 +13,21 @@ using namespace llvm;
1313
1414namespace {
1515TEST (RegisterTest, Idx2StackSlot) {
16- ASSERT_EQ (Register::index2StackSlot (0 ), Register::StackSlotZero);
17- ASSERT_EQ (Register::index2StackSlot (-1 ),
18- Register::StackSlotZero | Register::StackSlotMask);
19- ASSERT_EQ (Register::index2StackSlot (Register::StackSlotMask),
20- Register::StackSlotZero | Register::StackSlotMask);
21- ASSERT_EQ (Register::index2StackSlot (1 ), Register::StackSlotZero | 1 );
16+ EXPECT_EQ (Register::index2StackSlot (0 ), Register::StackSlotZero);
17+ EXPECT_EQ (Register::index2StackSlot (1 ), Register::StackSlotZero | 1 );
18+ EXPECT_EQ (Register::index2StackSlot (-1 ), Register::StackSlotZero | Register::StackSlotMask);
19+ // check that we do not crash on the highest possible value of frame index.
20+ EXPECT_NO_FATAL_FAILURE (Register::index2StackSlot ((1 << 29 ) - 1 ));
21+ // check that we do not crash on the lowest possible value of frame index.
22+ EXPECT_NO_FATAL_FAILURE (Register::index2StackSlot (-(1 << 29 )));
2223}
2324
2425TEST (RegisterTest, StackSlotIndex) {
25- Register Reg;
2626 std::vector<int64_t > FIs = {0 , 1 - 1 , (1 << 29 ) - 1 , -(1 << 29 )};
2727
2828 for (int64_t FI : FIs) {
29- Reg = Register::index2StackSlot (FI);
30- ASSERT_EQ (Reg.stackSlotIndex (), FI);
29+ Register Reg = Register::index2StackSlot (FI);
30+ EXPECT_EQ (Reg.stackSlotIndex (), FI);
3131 }
3232}
3333} // end namespace
0 commit comments