[llvm] r214953 - [x86] Switch to a formulation of a for loop that is much more obviously
Chandler Carruth
chandlerc at gmail.com
Wed Aug 6 03:16:34 PDT 2014
Author: chandlerc
Date: Wed Aug 6 05:16:33 2014
New Revision: 214953
URL: http://llvm.org/viewvc/llvm-project?rev=214953&view=rev
Log:
[x86] Switch to a formulation of a for loop that is much more obviously
not corrupting the mask by mutating it more times than intended. No
functionality changed (the results were non-overlapping so the old
version "worked" but was non-obvious).
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=214953&r1=214952&r2=214953&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Aug 6 05:16:33 2014
@@ -7519,9 +7519,10 @@ static SDValue lowerV8I16SingleInputVect
int FreeDWord = (PSHUFDMask[DestOffset / 2] == -1 ? 0 : 1) + DestOffset / 2;
assert(PSHUFDMask[FreeDWord] == -1 && "DWord not free");
PSHUFDMask[FreeDWord] = IncomingInputs[0] / 2;
- for (int Input : IncomingInputs)
- std::replace(HalfMask.begin(), HalfMask.end(), Input,
- FreeDWord * 2 + Input % 2);
+ for (int &M : HalfMask)
+ for (int Input : IncomingInputs)
+ if (M == Input)
+ M = FreeDWord * 2 + Input % 2;
};
moveInputsToRightHalf(HToLInputs, LToLInputs, PSHUFHMask, LoMask,
/*SourceOffset*/ 4, /*DestOffset*/ 0);
More information about the llvm-commits
mailing list