From 5e922eb0a37297e16e7e15deb6fea87486d4f29f 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. llvm-svn: 288671 --- llvm/lib/Target/X86/X86ISelLowering.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index bd8c6a2..6b23b61 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/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.7.4