[llvm] r305867 - [NewGVN] Fix a bug that made the store verifier less effective.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 20 15:57:40 PDT 2017


Author: davide
Date: Tue Jun 20 17:57:40 2017
New Revision: 305867

URL: http://llvm.org/viewvc/llvm-project?rev=305867&view=rev
Log:
[NewGVN] Fix a bug that made the store verifier less effective.

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).

Modified:
    llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp?rev=305867&r1=305866&r2=305867&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp Tue Jun 20 17:57:40 2017
@@ -3025,12 +3025,10 @@ void NewGVN::verifyStoreExpressions() co
       // 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) &&




More information about the llvm-commits mailing list