[llvm] r360244 - [Hexagon] Fix cppcheck reduce variable scope warnings. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Wed May 8 04:02:46 PDT 2019
Author: rksimon
Date: Wed May 8 04:02:46 2019
New Revision: 360244
URL: http://llvm.org/viewvc/llvm-project?rev=360244&view=rev
Log:
[Hexagon] Fix cppcheck reduce variable scope warnings. NFCI.
Also fixes a static analyzer "Value stored to 'S2' during its initialization is never read" warning.
Modified:
llvm/trunk/lib/Target/Hexagon/HexagonStoreWidening.cpp
Modified: llvm/trunk/lib/Target/Hexagon/HexagonStoreWidening.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonStoreWidening.cpp?rev=360244&r1=360243&r2=360244&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonStoreWidening.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonStoreWidening.cpp Wed May 8 04:02:46 2019
@@ -337,8 +337,7 @@ bool HexagonStoreWidening::selectStores(
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(
// 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(
break;
S1 = S2;
- ++I;
}
// The stores don't add up to anything that can be widened. Clean up.
More information about the llvm-commits
mailing list