mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-09-30 04:56:49 +00:00
Remove unnecessary type check when combining and/or/xor of swizzles. Move some checks to allow better early out.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154309 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b7135e5838
commit
f920423ffc
@ -2361,18 +2361,16 @@ SDValue DAGCombiner::SimplifyBinOpWithSameOpcodeHands(SDNode *N) {
|
|||||||
// The type-legalizer generates this pattern when loading illegal
|
// The type-legalizer generates this pattern when loading illegal
|
||||||
// vector types from memory. In many cases this allows additional shuffle
|
// vector types from memory. In many cases this allows additional shuffle
|
||||||
// optimizations.
|
// optimizations.
|
||||||
if (N0.getOpcode() == ISD::VECTOR_SHUFFLE && Level < AfterLegalizeDAG) {
|
if (N0.getOpcode() == ISD::VECTOR_SHUFFLE && Level < AfterLegalizeDAG &&
|
||||||
|
N0.getOperand(1).getOpcode() == ISD::UNDEF &&
|
||||||
|
N1.getOperand(1).getOpcode() == ISD::UNDEF) {
|
||||||
ShuffleVectorSDNode *SVN0 = cast<ShuffleVectorSDNode>(N0);
|
ShuffleVectorSDNode *SVN0 = cast<ShuffleVectorSDNode>(N0);
|
||||||
ShuffleVectorSDNode *SVN1 = cast<ShuffleVectorSDNode>(N1);
|
ShuffleVectorSDNode *SVN1 = cast<ShuffleVectorSDNode>(N1);
|
||||||
SDValue In0 = SVN0->getOperand(0);
|
|
||||||
SDValue In1 = SVN1->getOperand(0);
|
assert(N0.getOperand(0).getValueType() == N1.getOperand(1).getValueType() &&
|
||||||
EVT In0Ty = In0.getValueType();
|
"Inputs to shuffles are not the same type");
|
||||||
EVT In1Ty = In1.getValueType();
|
|
||||||
|
|
||||||
unsigned NumElts = VT.getVectorNumElements();
|
unsigned NumElts = VT.getVectorNumElements();
|
||||||
// Check that both shuffles are swizzles.
|
|
||||||
bool SingleVecShuff = (N0.getOperand(1).getOpcode() == ISD::UNDEF &&
|
|
||||||
N1.getOperand(1).getOpcode() == ISD::UNDEF);
|
|
||||||
|
|
||||||
// Check that both shuffles use the same mask. The masks are known to be of
|
// Check that both shuffles use the same mask. The masks are known to be of
|
||||||
// the same length because the result vector type is the same.
|
// the same length because the result vector type is the same.
|
||||||
@ -2386,14 +2384,15 @@ SDValue DAGCombiner::SimplifyBinOpWithSameOpcodeHands(SDNode *N) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SameMask && SingleVecShuff && In0Ty == In1Ty) {
|
if (SameMask) {
|
||||||
SDValue Op = DAG.getNode(N->getOpcode(), N->getDebugLoc(), VT, In0, In1);
|
SDValue Op = DAG.getNode(N->getOpcode(), N->getDebugLoc(), VT,
|
||||||
SDValue Shuff = DAG.getVectorShuffle(VT, N->getDebugLoc(), Op,
|
N0.getOperand(0), N1.getOperand(0));
|
||||||
DAG.getUNDEF(VT), &SVN0->getMask()[0]);
|
|
||||||
AddToWorkList(Op.getNode());
|
AddToWorkList(Op.getNode());
|
||||||
return Shuff;
|
return DAG.getVectorShuffle(VT, N->getDebugLoc(), Op,
|
||||||
|
DAG.getUNDEF(VT), &SVN0->getMask()[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return SDValue();
|
return SDValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user