[llvm] r218565 - [x86] Fix yet another issue with widening vector shuffle elements.

Chandler Carruth chandlerc at gmail.com
Sat Sep 27 01:40:34 PDT 2014


Author: chandlerc
Date: Sat Sep 27 03:40:33 2014
New Revision: 218565

URL: http://llvm.org/viewvc/llvm-project?rev=218565&view=rev
Log:
[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.

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=218565&r1=218564&r2=218565&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sat Sep 27 03:40:33 2014
@@ -9884,11 +9884,11 @@ static bool canWidenShuffleElements(Arra
 
     // 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;
     }





More information about the llvm-commits mailing list