[llvm] 385f380 - [MemorySSA] Fix "set but not used" warnings

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 15 11:41:52 PDT 2021


Author: Kazu Hirata
Date: 2021-09-15T11:41:41-07:00
New Revision: 385f380e806a10549d91466e7ca22121c866d287

URL: https://github.com/llvm/llvm-project/commit/385f380e806a10549d91466e7ca22121c866d287
DIFF: https://github.com/llvm/llvm-project/commit/385f380e806a10549d91466e7ca22121c866d287.diff

LOG: [MemorySSA] Fix "set but not used" warnings

Added: 
    

Modified: 
    llvm/lib/Analysis/MemorySSA.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/MemorySSA.cpp b/llvm/lib/Analysis/MemorySSA.cpp
index b97cd0c6b186..e005e2835ce5 100644
--- a/llvm/lib/Analysis/MemorySSA.cpp
+++ b/llvm/lib/Analysis/MemorySSA.cpp
@@ -1934,6 +1934,8 @@ void MemorySSA::verifyPrevDefInPhis(Function &F) const {
               auto *LastAcc = &*(--DefList->end());
               assert(LastAcc == IncAcc &&
                      "Incorrect incoming access into phi.");
+              (void)IncAcc;
+              (void)LastAcc;
               break;
             }
             DTNode = DTNode->getIDom();
@@ -1979,6 +1981,7 @@ void MemorySSA::verifyDominationNumbers(const Function &F) const {
       unsigned long ThisNumber = ThisNumberIter->second;
       assert(ThisNumber > LastNumber &&
              "Domination numbers should be strictly increasing!");
+      (void)LastNumber;
       LastNumber = ThisNumber;
     }
   }
@@ -2009,8 +2012,10 @@ void MemorySSA::verifyOrderingDominationAndDefUses(Function &F,
       ActualAccesses.push_back(Phi);
       ActualDefs.push_back(Phi);
       // Verify domination
-      for (const Use &U : Phi->uses())
+      for (const Use &U : Phi->uses()) {
         assert(dominates(Phi, U) && "Memory PHI does not dominate it's uses");
+        (void)U;
+      }
       // Verify def-uses for full verify.
       if (VL == VerificationLevel::Full) {
         assert(Phi->getNumOperands() == static_cast<unsigned>(std::distance(
@@ -2037,9 +2042,11 @@ void MemorySSA::verifyOrderingDominationAndDefUses(Function &F,
           // Verify ordering.
           ActualDefs.push_back(MA);
           // Verify domination.
-          for (const Use &U : MD->uses())
+          for (const Use &U : MD->uses()) {
             assert(dominates(MD, U) &&
                    "Memory Def does not dominate it's uses");
+            (void)U;
+          }
         }
         // Verify def-uses for full verify.
         if (VL == VerificationLevel::Full)


        


More information about the llvm-commits mailing list