mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 21:24:00 +00:00
Correct extractelement constant folding
Summary: Constant folding of extractelement with out-of-bound index produces undef also for indexes bigger than 64bit (instead of crash assert failure as before) Test Plan: Unit tests included. Reviewers: majnemer Reviewed By: majnemer Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D9225 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235700 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -187,6 +187,10 @@ TEST(ConstantsTest, AsInstructionsTest) {
|
||||
Constant *P6 = ConstantExpr::getBitCast(P4, VectorType::get(Int16Ty, 2));
|
||||
|
||||
Constant *One = ConstantInt::get(Int32Ty, 1);
|
||||
Constant *Two = ConstantInt::get(Int64Ty, 2);
|
||||
Constant *Big = ConstantInt::get(getGlobalContext(),
|
||||
APInt{256, uint64_t(-1), true});
|
||||
Constant *Undef = UndefValue::get(Int64Ty);
|
||||
|
||||
#define P0STR "ptrtoint (i32** @dummy to i32)"
|
||||
#define P1STR "uitofp (i32 ptrtoint (i32** @dummy to i32) to float)"
|
||||
@ -255,6 +259,10 @@ TEST(ConstantsTest, AsInstructionsTest) {
|
||||
|
||||
CHECK(ConstantExpr::getExtractElement(P6, One), "extractelement <2 x i16> "
|
||||
P6STR ", i32 1");
|
||||
|
||||
EXPECT_TRUE(isa<UndefValue>(ConstantExpr::getExtractElement(P6, Two)));
|
||||
EXPECT_TRUE(isa<UndefValue>(ConstantExpr::getExtractElement(P6, Big)));
|
||||
EXPECT_TRUE(isa<UndefValue>(ConstantExpr::getExtractElement(P6, Undef)));
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
|
Reference in New Issue
Block a user