summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86ISelLowering.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2014-08-06 10:16:33 +0000
committerChandler Carruth <chandlerc@gmail.com>2014-08-06 10:16:33 +0000
commit8f23ba26d25d03d7deb7c7ccd46824ed713bc04b (patch)
tree6bacc3356b7dca57c8d7cfce2b6bac6c82080f42 /llvm/lib/Target/X86/X86ISelLowering.cpp
parent6fd227c9ad44582dee3c096ea6a1e1c429e8d253 (diff)
downloadbcm5719-llvm-8f23ba26d25d03d7deb7c7ccd46824ed713bc04b.tar.gz
bcm5719-llvm-8f23ba26d25d03d7deb7c7ccd46824ed713bc04b.zip
[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). llvm-svn: 214953
Diffstat (limited to 'llvm/lib/Target/X86/X86ISelLowering.cpp')
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 18b3bb25cae..7bf58e20dac 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -7519,9 +7519,10 @@ static SDValue lowerV8I16SingleInputVectorShuffle(
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);
OpenPOWER on IntegriCloud