diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2023-10-24 14:12:55 +0200 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2023-10-24 14:14:39 +0200 |
commit | eb67b34740b37909f1b213fca6c564257577be25 (patch) | |
tree | 0e8d9b7720dc803062579f8e2711072fd6899de1 /llvm/unittests/Transforms | |
parent | 4a074f32a6914f2a8d7215d78758c24942dddc3d (diff) | |
download | llvm-eb67b34740b37909f1b213fca6c564257577be25.zip llvm-eb67b34740b37909f1b213fca6c564257577be25.tar.gz llvm-eb67b34740b37909f1b213fca6c564257577be25.tar.bz2 |
[IPSCCP] Don't crash on ptrtoint
Diffstat (limited to 'llvm/unittests/Transforms')
-rw-r--r-- | llvm/unittests/Transforms/Utils/LocalTest.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/unittests/Transforms/Utils/LocalTest.cpp b/llvm/unittests/Transforms/Utils/LocalTest.cpp index 64bd25f..a27af6e 100644 --- a/llvm/unittests/Transforms/Utils/LocalTest.cpp +++ b/llvm/unittests/Transforms/Utils/LocalTest.cpp @@ -1223,6 +1223,11 @@ TEST(Local, ExpressionForConstant) { EXPECT_NE(Expr, nullptr); EXPECT_EQ(Expr->getElement(1), 0x7FFFFFFFFFFFFFFFU); + GlobalVariable *String = + IRBuilder<>(Context).CreateGlobalString("hello", "hello", 0, &M); + Expr = createExpression(ConstantExpr::getPtrToInt(String, Int32Ty), Int32Ty); + EXPECT_EQ(Expr, nullptr); + // Float. Type *FloatTy = Type::getFloatTy(Context); Expr = createExpression(ConstantFP::get(FloatTy, 5.55), FloatTy); |