summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/IR/ConstantsTest.cpp
diff options
context:
space:
mode:
authorMichael Platings <michael.platings@arm.com>2019-03-07 11:55:26 +0000
committerMichael Platings <michael.platings@arm.com>2019-03-07 11:55:26 +0000
commitcfd32552513dbfdc88336659fc8c8e460d973cd2 (patch)
treeb745c3e1bc48e25cb4cbde5cc531e955499a0971 /llvm/unittests/IR/ConstantsTest.cpp
parent9ade843ccb88bb1b6266029bce4bb7615b99f669 (diff)
downloadbcm5719-llvm-cfd32552513dbfdc88336659fc8c8e460d973cd2.tar.gz
bcm5719-llvm-cfd32552513dbfdc88336659fc8c8e460d973cd2.zip
Fix & re-enable test that intermittently failed in debug mode.
The Value class and derivates will have uninitialized member variables if not created via operator new. llvm-svn: 355590
Diffstat (limited to 'llvm/unittests/IR/ConstantsTest.cpp')
-rw-r--r--llvm/unittests/IR/ConstantsTest.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/unittests/IR/ConstantsTest.cpp b/llvm/unittests/IR/ConstantsTest.cpp
index 4d967d29097..34ebd59bc3d 100644
--- a/llvm/unittests/IR/ConstantsTest.cpp
+++ b/llvm/unittests/IR/ConstantsTest.cpp
@@ -556,20 +556,21 @@ TEST(ConstantsTest, DontFoldFunctionPtrIfNoModule) {
ASSERT_FALSE(foldFuncPtrAndConstToNull(Context, nullptr, 2, 4));
}
-TEST(ConstantsTest, DISABLED_FoldGlobalVariablePtr) {
+TEST(ConstantsTest, FoldGlobalVariablePtr) {
LLVMContext Context;
IntegerType *IntType(Type::getInt32Ty(Context));
- GlobalVariable Global(IntType, true, GlobalValue::ExternalLinkage);
+ std::unique_ptr<GlobalVariable> Global(
+ new GlobalVariable(IntType, true, GlobalValue::ExternalLinkage));
- Global.setAlignment(4);
+ Global->setAlignment(4);
ConstantInt *TheConstant(ConstantInt::get(IntType, 2));
Constant *TheConstantExpr(
- ConstantExpr::getPtrToInt(&Global, IntType));
+ ConstantExpr::getPtrToInt(Global.get(), IntType));
ASSERT_TRUE(ConstantExpr::get( \
Instruction::And, TheConstantExpr, TheConstant)->isNullValue());
OpenPOWER on IntegriCloud