[llvm] r361821 - [DAG] LegalizeVectorTypes - reduce scope of local variables. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue May 28 06:46:26 PDT 2019
Author: rksimon
Date: Tue May 28 06:46:26 2019
New Revision: 361821
URL: http://llvm.org/viewvc/llvm-project?rev=361821&view=rev
Log:
[DAG] LegalizeVectorTypes - reduce scope of local variables. NFCI.
Move the element index/count variables into the block where they are actually used - appeases cppcheck and helps avoid shadow variable warnings.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp?rev=361821&r1=361820&r2=361821&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Tue May 28 06:46:26 2019
@@ -2812,14 +2812,13 @@ static SDValue CollectOpsToWiden(Selecti
SDLoc dl(ConcatOps[0]);
EVT WidenEltVT = WidenVT.getVectorElementType();
- int Idx = 0;
// while (Some element of ConcatOps is not of type MaxVT) {
// From the end of ConcatOps, collect elements of the same type and put
// them into an op of the next larger supported type
// }
while (ConcatOps[ConcatEnd-1].getValueType() != MaxVT) {
- Idx = ConcatEnd - 1;
+ int Idx = ConcatEnd - 1;
VT = ConcatOps[Idx--].getValueType();
while (Idx >= 0 && ConcatOps[Idx].getValueType() == VT)
Idx--;
@@ -4378,10 +4377,9 @@ SDValue DAGTypeLegalizer::WidenVecOp_MSC
SDValue Index = MSC->getIndex();
SDValue Scale = MSC->getScale();
- unsigned NumElts;
if (OpNo == 1) {
DataOp = GetWidenedVector(DataOp);
- NumElts = DataOp.getValueType().getVectorNumElements();
+ unsigned NumElts = DataOp.getValueType().getVectorNumElements();
// Widen index.
EVT IndexVT = Index.getValueType();
More information about the llvm-commits
mailing list