]> granicus.if.org Git - llvm/commitdiff
[AliasAnalysis] Initialize a member variable that may be used by unit test.
authorPeter Smith <peter.smith@linaro.org>
Fri, 2 Aug 2019 08:05:14 +0000 (08:05 +0000)
committerPeter Smith <peter.smith@linaro.org>
Fri, 2 Aug 2019 08:05:14 +0000 (08:05 +0000)
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
unittests/Analysis/BasicAliasAnalysisTest.cpp

index 948341554f2334f0230b41d8be7bedecbc2a5fa7..282142f51bb39665b6760f8d069e7478f5986d79 100644 (file)
@@ -949,7 +949,7 @@ template <typename DerivedT> 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<DerivedT &>(*this); }
index c08366ebc6e43da5e92cc2ac659fc17e9986aff8..f69d2d14a6c0bb35c53de69aa5aef0a5b1be95dd 100644 (file)
@@ -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);