From 6f9189d7b1826408f0408199e73f44261361cb8b Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Fri, 2 Aug 2019 08:05:14 +0000 Subject: [PATCH] [AliasAnalysis] Initialize a member variable that may be used by unit test. The unit tests in BasicAliasAnalysisTest use the alias analysis API directly and do not call setAAResults to initalize AAR. This gives a valgrind error "Conditional Jump depends on unitialized variable". On most buildbots the variable is nullptr, but in some cases it can be non nullptr leading to seemingly random failures. These tests were disabled in r366986. With the initialization they can be enabled again. Fixes PR42719 Differential Revision: https://reviews.llvm.org/D65568 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367662 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/AliasAnalysis.h | 2 +- unittests/Analysis/BasicAliasAnalysisTest.cpp | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/include/llvm/Analysis/AliasAnalysis.h b/include/llvm/Analysis/AliasAnalysis.h index 948341554f2..282142f51bb 100644 --- a/include/llvm/Analysis/AliasAnalysis.h +++ b/include/llvm/Analysis/AliasAnalysis.h @@ -949,7 +949,7 @@ template class AAResultBase { /// A pointer to the AAResults object that this AAResult is /// aggregated within. May be null if not aggregated. - AAResults *AAR; + AAResults *AAR = nullptr; /// Helper to dispatch calls back through the derived type. DerivedT &derived() { return static_cast(*this); } diff --git a/unittests/Analysis/BasicAliasAnalysisTest.cpp b/unittests/Analysis/BasicAliasAnalysisTest.cpp index c08366ebc6e..f69d2d14a6c 100644 --- a/unittests/Analysis/BasicAliasAnalysisTest.cpp +++ b/unittests/Analysis/BasicAliasAnalysisTest.cpp @@ -64,13 +64,10 @@ public: : M("BasicAATest", C), B(C), DL(DLString), TLI(TLII), F(nullptr) {} }; -// FIXME: Both of these are disabled at the moment due to strange buildbot -// failures. Please see https://bugs.llvm.org/show_bug.cgi?id=42719 - // Check that a function arg can't trivially alias a global when we're accessing // >sizeof(global) bytes through that arg, unless the access size is just an // upper-bound. -TEST_F(BasicAATest, DISABLED_AliasInstWithObjectOfImpreciseSize) { +TEST_F(BasicAATest, AliasInstWithObjectOfImpreciseSize) { F = Function::Create( FunctionType::get(B.getVoidTy(), {B.getInt32Ty()->getPointerTo()}, false), GlobalValue::ExternalLinkage, "F", &M); @@ -104,7 +101,7 @@ TEST_F(BasicAATest, DISABLED_AliasInstWithObjectOfImpreciseSize) { // Check that we fall back to MayAlias if we see an access of an entire object // that's just an upper-bound. -TEST_F(BasicAATest, DISABLED_AliasInstWithFullObjectOfImpreciseSize) { +TEST_F(BasicAATest, AliasInstWithFullObjectOfImpreciseSize) { F = Function::Create( FunctionType::get(B.getVoidTy(), {B.getInt64Ty()}, false), GlobalValue::ExternalLinkage, "F", &M); -- 2.40.0