[llvm] r367662 - [AliasAnalysis] Initialize a member variable that may be used by unit test.

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 2 01:05:14 PDT 2019


Author: psmith
Date: Fri Aug  2 01:05:14 2019
New Revision: 367662

URL: http://llvm.org/viewvc/llvm-project?rev=367662&view=rev
Log:
[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


Modified:
    llvm/trunk/include/llvm/Analysis/AliasAnalysis.h
    llvm/trunk/unittests/Analysis/BasicAliasAnalysisTest.cpp

Modified: llvm/trunk/include/llvm/Analysis/AliasAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/AliasAnalysis.h?rev=367662&r1=367661&r2=367662&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/AliasAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/AliasAnalysis.h Fri Aug  2 01:05:14 2019
@@ -949,7 +949,7 @@ template <typename DerivedT> class AARes
 
   /// 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); }

Modified: llvm/trunk/unittests/Analysis/BasicAliasAnalysisTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Analysis/BasicAliasAnalysisTest.cpp?rev=367662&r1=367661&r2=367662&view=diff
==============================================================================
--- llvm/trunk/unittests/Analysis/BasicAliasAnalysisTest.cpp (original)
+++ llvm/trunk/unittests/Analysis/BasicAliasAnalysisTest.cpp Fri Aug  2 01:05:14 2019
@@ -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_AliasInstWi
 
 // 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);




More information about the llvm-commits mailing list