From 4b0a367e90ac3656ba054cf0f270fb7fa577a80d Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Mon, 5 Dec 2016 14:25:04 +0000 Subject: [PATCH] Use range based for loop. NFCI. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288671 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86ISelLowering.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index bd8c6a2302d..6b23b6187a9 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -27396,13 +27396,10 @@ static SDValue combineShuffleOfConcatUndef(SDNode *N, SelectionDAG &DAG, // index, but elements from the second source no longer need to skip an undef. SmallVector Mask; int NumElts = VT.getVectorNumElements(); - for (int i = 0; i < NumElts; ++i) { - int Elt = cast(N)->getMaskElt(i); - if (Elt < NumElts) - Mask.push_back(Elt); - else - Mask.push_back(Elt - NumElts / 2); - } + + ShuffleVectorSDNode *SVOp = cast(N); + for (int Elt : SVOp->getMask()) + Mask.push_back(Elt < NumElts ? Elt : (Elt - NumElts / 2)); SDLoc DL(N); SDValue Concat = DAG.getNode(ISD::CONCAT_VECTORS, DL, VT, N0.getOperand(0), -- 2.11.0