summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorMon P Wang <wangmp@apple.com>2008-12-11 00:26:16 +0000
committerMon P Wang <wangmp@apple.com>2008-12-11 00:26:16 +0000
commitb5eb7205eaaa2ccf56ade2d0c7904fe9035c92f3 (patch)
treed7bf01cae024fe610a8dac94aa1b03159b8a726f /llvm/lib
parent0bc1320d9548c7191b6420c2aa17adab02c36048 (diff)
downloadbcm5719-llvm-b5eb7205eaaa2ccf56ade2d0c7904fe9035c92f3.tar.gz
bcm5719-llvm-b5eb7205eaaa2ccf56ade2d0c7904fe9035c92f3.zip
Make fix for r60829 less conservative to allow the proper optimization for
vec_extract-sse4.ll. llvm-svn: 60865
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 7e78923f6d9..ec71f62519b 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -4884,14 +4884,16 @@ SDValue DAGCombiner::visitEXTRACT_VECTOR_ELT(SDNode *N) {
if (isa<ConstantSDNode>(EltNo)) {
unsigned Elt = cast<ConstantSDNode>(EltNo)->getZExtValue();
bool NewLoad = false;
+ bool BCNumEltsChanged = false;
MVT VT = InVec.getValueType();
MVT EVT = VT.getVectorElementType();
MVT LVT = EVT;
if (InVec.getOpcode() == ISD::BIT_CONVERT) {
MVT BCVT = InVec.getOperand(0).getValueType();
- if (!BCVT.isVector() || EVT.bitsGT(BCVT.getVectorElementType()) ||
- VT.getVectorNumElements() != BCVT.getVectorNumElements())
+ if (!BCVT.isVector() || EVT.bitsGT(BCVT.getVectorElementType()))
return SDValue();
+ if (VT.getVectorNumElements() != BCVT.getVectorNumElements())
+ BCNumEltsChanged = true;
InVec = InVec.getOperand(0);
EVT = BCVT.getVectorElementType();
NewLoad = true;
@@ -4908,6 +4910,11 @@ SDValue DAGCombiner::visitEXTRACT_VECTOR_ELT(SDNode *N) {
// (vextract (vector_shuffle (load $addr), v2, <1, u, u, u>), 1)
// =>
// (load $addr+1*size)
+
+ // If the bit convert changed the number of elements, it is unsafe
+ // to examine the mask.
+ if (BCNumEltsChanged)
+ return SDValue();
unsigned Idx = cast<ConstantSDNode>(InVec.getOperand(2).
getOperand(Elt))->getZExtValue();
unsigned NumElems = InVec.getOperand(2).getNumOperands();
OpenPOWER on IntegriCloud