[llvm] r355590 - Fix & re-enable test that intermittently failed in debug mode.
Michael Platings via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 7 03:55:26 PST 2019
Author: michaelplatings
Date: Thu Mar 7 03:55:26 2019
New Revision: 355590
URL: http://llvm.org/viewvc/llvm-project?rev=355590&view=rev
Log:
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.
Modified:
llvm/trunk/unittests/IR/ConstantsTest.cpp
Modified: llvm/trunk/unittests/IR/ConstantsTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/ConstantsTest.cpp?rev=355590&r1=355589&r2=355590&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/ConstantsTest.cpp (original)
+++ llvm/trunk/unittests/IR/ConstantsTest.cpp Thu Mar 7 03:55:26 2019
@@ -556,20 +556,21 @@ TEST(ConstantsTest, DontFoldFunctionPtrI
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());
More information about the llvm-commits
mailing list