[llvm] r368998 - [DAGCombine] MergeConsecutiveStores - fix cppcheck/MSVC extension warning. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 15 06:07:14 PDT 2019


Author: rksimon
Date: Thu Aug 15 06:07:14 2019
New Revision: 368998

URL: http://llvm.org/viewvc/llvm-project?rev=368998&view=rev
Log:
[DAGCombine] MergeConsecutiveStores - fix cppcheck/MSVC extension warning. NFCI.

Set the StartIdx type to size_t so that it matches the StoreNodes SmallVector size() and index types.

Silences the MSVC analyzer warning that unsigned increment might overflow before exceeding size_t on 64-bit targets - this isn't likely to happen but it means we use consistent types and reduces the warning "noise" a little.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=368998&r1=368997&r2=368998&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Aug 15 06:07:14 2019
@@ -15396,7 +15396,7 @@ bool DAGCombiner::MergeConsecutiveStores
 
   bool RV = false;
   while (StoreNodes.size() > 1) {
-    unsigned StartIdx = 0;
+    size_t StartIdx = 0;
     while ((StartIdx + 1 < StoreNodes.size()) &&
            StoreNodes[StartIdx].OffsetFromBase + ElementSizeBytes !=
                StoreNodes[StartIdx + 1].OffsetFromBase)




More information about the llvm-commits mailing list