From: Chandler Carruth Date: Sat, 27 Sep 2014 08:40:33 +0000 (+0000) Subject: [x86] Fix yet another issue with widening vector shuffle elements. X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=b66b0cf2ebe25eafbfad7b54ebc96a9b260fb57d [x86] Fix yet another issue with widening vector shuffle elements. I spotted this by inspection when debugging something else, so I have no test case what-so-ever, and am not even sure it is possible to realistically trigger the bug. But this is what was intended here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218565 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 17f925bd3e8..4678340b6fb 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -9884,11 +9884,11 @@ static bool canWidenShuffleElements(ArrayRef Mask, // Check for an undef mask and a mask value properly aligned to fit with // a pair of values. If we find such a case, use the non-undef mask's value. - if (Mask[i] == -1 && Mask[i + 1] % 2 == 1) { + if (Mask[i] == -1 && Mask[i + 1] >= 0 && Mask[i + 1] % 2 == 1) { WidenedMask.push_back(Mask[i + 1] / 2); continue; } - if (Mask[i + 1] == -1 && Mask[i] % 2 == 0) { + if (Mask[i + 1] == -1 && Mask[i] >= 0 && Mask[i] % 2 == 0) { WidenedMask.push_back(Mask[i] / 2); continue; }