OSDN Git Service

[NewGVN] Fix a bug that made the store verifier less effective.
authorDavide Italiano <davide@freebsd.org>
Tue, 20 Jun 2017 22:57:40 +0000 (22:57 +0000)
committerDavide Italiano <davide@freebsd.org>
Tue, 20 Jun 2017 22:57:40 +0000 (22:57 +0000)
We weren't actually checking for duplicated stores, as the condition
was always actually false. This was found by Coverity, and I have
no clue how to trigger this in real-world code (although I
 tried for a bit).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305867 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/NewGVN.cpp

index 1d74e20..7a7624f 100644 (file)
@@ -3025,12 +3025,10 @@ void NewGVN::verifyStoreExpressions() const {
       // It's okay to have the same expression already in there if it is
       // identical in nature.
       // This can happen when the leader of the stored value changes over time.
-      if (!Okay) {
-        Okay = Okay && std::get<1>(Res.first->second) == KV.second;
-        Okay = Okay &&
-               lookupOperandLeader(std::get<2>(Res.first->second)) ==
-                   lookupOperandLeader(SE->getStoredValue());
-      }
+      if (!Okay)
+        Okay = (std::get<1>(Res.first->second) == KV.second) &&
+               (lookupOperandLeader(std::get<2>(Res.first->second)) ==
+                lookupOperandLeader(SE->getStoredValue()));
       assert(Okay && "Stored expression conflict exists in expression table");
       auto *ValueExpr = ValueToExpression.lookup(SE->getStoreInst());
       assert(ValueExpr && ValueExpr->equals(*SE) &&