diff options
author | Mon P Wang <wangmp@apple.com> | 2008-11-06 22:52:21 +0000 |
---|---|---|
committer | Mon P Wang <wangmp@apple.com> | 2008-11-06 22:52:21 +0000 |
commit | 927daf5880231a034bd58f899d30a03a553b4135 (patch) | |
tree | 57d5d3c981047d6c2c9ea4251273df1739cf081e /lib | |
parent | d5f8bf6d182ee2e047e856f742901f24afc0115b (diff) | |
download | external_llvm-927daf5880231a034bd58f899d30a03a553b4135.tar.gz external_llvm-927daf5880231a034bd58f899d30a03a553b4135.tar.bz2 external_llvm-927daf5880231a034bd58f899d30a03a553b4135.zip |
Fixed scalarizing an extract subvector and prevent an infinite loop
when simplify a vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58820 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 6 | ||||
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 6 |
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index f9d1ddc615..c17ef9cedc 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -7516,8 +7516,8 @@ SDValue SelectionDAGLegalize::ScalarizeVectorOp(SDValue Op) { break; } case ISD::EXTRACT_SUBVECTOR: - Result = Node->getOperand(0); - assert(Result.getValueType() == NewVT); + Result = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, NewVT, Node->getOperand(0), + Node->getOperand(1)); break; case ISD::BIT_CONVERT: { SDValue Op0 = Op.getOperand(0); @@ -8174,7 +8174,7 @@ void SelectionDAGLegalize::genWidenVectorStores(SDValueVector& StChain, SDValue VecOp = DAG.getNode(ISD::BIT_CONVERT, VecEVT, ValOp); SDValue EOp = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, EVT, VecOp, - DAG.getIntPtrConstant(0)); + DAG.getIntPtrConstant(0)); SDValue StOp = DAG.getStore(Chain, EOp, BasePtr, SV, SVOffset, isVolatile, Alignment); StChain.push_back(StOp); diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 3210b12cbb..743d8bb15f 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -1410,6 +1410,12 @@ Value *InstCombiner::SimplifyDemandedVectorElts(Value *V, uint64_t DemandedElts, } else if (isa<ConstantAggregateZero>(V)) { // Simplify the CAZ to a ConstantVector where the non-demanded elements are // set to undef. + + // Check if this is identity. If so, return 0 since we are not simplifying + // anything. + if (DemandedElts == ((1ULL << VWidth) -1)) + return 0; + const Type *EltTy = cast<VectorType>(V->getType())->getElementType(); Constant *Zero = Constant::getNullValue(EltTy); Constant *Undef = UndefValue::get(EltTy); |