diff options
| author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-05-08 11:02:46 +0000 |
|---|---|---|
| committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-05-08 11:02:46 +0000 |
| commit | ec580904916f140c6cae7b0198d2746680f7e356 (patch) | |
| tree | eef2013bc5c47628440e564ff7ce267b09a40ee6 /llvm/lib/Target/Hexagon | |
| parent | d52a542e4cb65d4fe5a5e7c5a09c1088ba58cff2 (diff) | |
| download | bcm5719-llvm-ec580904916f140c6cae7b0198d2746680f7e356.tar.gz bcm5719-llvm-ec580904916f140c6cae7b0198d2746680f7e356.zip | |
[Hexagon] Fix cppcheck reduce variable scope warnings. NFCI.
Also fixes a static analyzer "Value stored to 'S2' during its initialization is never read" warning.
llvm-svn: 360244
Diffstat (limited to 'llvm/lib/Target/Hexagon')
| -rw-r--r-- | llvm/lib/Target/Hexagon/HexagonStoreWidening.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/llvm/lib/Target/Hexagon/HexagonStoreWidening.cpp b/llvm/lib/Target/Hexagon/HexagonStoreWidening.cpp index a306c0ddade..b8b61517ff9 100644 --- a/llvm/lib/Target/Hexagon/HexagonStoreWidening.cpp +++ b/llvm/lib/Target/Hexagon/HexagonStoreWidening.cpp @@ -337,8 +337,7 @@ bool HexagonStoreWidening::selectStores(InstrGroup::iterator Begin, return false; OG.push_back(FirstMI); - MachineInstr *S1 = FirstMI, *S2 = *(Begin+1); - InstrGroup::iterator I = Begin+1; + MachineInstr *S1 = FirstMI; // Pow2Num will be the largest number of elements in OG such that the sum // of sizes of stores 0...Pow2Num-1 will be a power of 2. @@ -350,8 +349,8 @@ bool HexagonStoreWidening::selectStores(InstrGroup::iterator Begin, // does not exceed the limit (MaxSize). // Keep track of when the total size covered is a power of 2, since // this is a size a single store can cover. - while (I != End) { - S2 = *I; + for (InstrGroup::iterator I = Begin + 1; I != End; ++I) { + MachineInstr *S2 = *I; // Stores are sorted, so if S1 and S2 are not adjacent, there won't be // any other store to fill the "hole". if (!storesAreAdjacent(S1, S2)) @@ -371,7 +370,6 @@ bool HexagonStoreWidening::selectStores(InstrGroup::iterator Begin, break; S1 = S2; - ++I; } // The stores don't add up to anything that can be widened. Clean up. |

