From: Chandler Carruth Date: Sun, 15 Feb 2015 09:33:36 +0000 (+0000) Subject: [x86] Make computing the zeroable elements slightly more powerful, at X-Git-Tag: llvmorg-3.7.0-rc1~12014 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a6f8a3661c0a038555607f0aefbe8df6d46ca695;p=platform%2Fupstream%2Fllvm.git [x86] Make computing the zeroable elements slightly more powerful, at least in theory. I don't actually have a test case that benefits from this, but theoretically, it could come up, and I don't want to try to think about whether this is the culprit or something else is, so I'd rather just make this code powerful. =/ Makes me sad that I can't really test it though. llvm-svn: 229298 --- diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 3bf4349..4e8616f 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -7735,6 +7735,11 @@ static SmallBitVector computeZeroableShuffleElements(ArrayRef Mask, SDValue V1, SDValue V2) { SmallBitVector Zeroable(Mask.size(), false); + while (V1.getOpcode() == ISD::BITCAST) + V1 = V1->getOperand(0); + while (V2.getOpcode() == ISD::BITCAST) + V2 = V2->getOperand(0); + bool V1IsZero = ISD::isBuildVectorAllZeros(V1.getNode()); bool V2IsZero = ISD::isBuildVectorAllZeros(V2.getNode()); @@ -7746,10 +7751,10 @@ static SmallBitVector computeZeroableShuffleElements(ArrayRef Mask, continue; } - // If this is an index into a build_vector node, dig out the input value and - // use it. + // If this is an index into a build_vector node (which has the same number + // of elements), dig out the input value and use it. SDValue V = M < Size ? V1 : V2; - if (V.getOpcode() != ISD::BUILD_VECTOR) + if (V.getOpcode() != ISD::BUILD_VECTOR || Size != (int)V.getNumOperands()) continue; SDValue Input = V.getOperand(M % Size);