DivergenceAnalysisTest: fix use of uninitialized memory
authorNicolai Haehnle <nhaehnle@gmail.com>
Thu, 18 Oct 2018 12:54:39 +0000 (12:54 +0000)
committerNicolai Haehnle <nhaehnle@gmail.com>
Thu, 18 Oct 2018 12:54:39 +0000 (12:54 +0000)
Thanks to Simon Moll for chasing it down.

Change-Id: If188f07c4aaec217f40a7a2ca029818f9202f1cb
llvm-svn: 344738

llvm/unittests/Analysis/DivergenceAnalysisTest.cpp

index 8afd4bf..97dbd18 100644 (file)
@@ -302,7 +302,7 @@ TEST_F(DivergenceAnalysisTest, DAJoinDivergence) {
         if (!Phi)
           continue;
 
-        if (&BB == *ItDivJoins) {
+        if (ItDivJoins != ItCase.second.end() && &BB == *ItDivJoins) {
           EXPECT_TRUE(DA.isDivergent(*Phi));
           // Advance to next block with expected divergent PHI node.
           ++ItDivJoins;