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 | e0b436ac41a00bc210163964d3cf393c8b487c9e (patch) | |
tree | 57d5d3c981047d6c2c9ea4251273df1739cf081e /lib/Transforms/Scalar | |
parent | 703ccfe0538a30d674b52fdbb4f5debf9b062354 (diff) | |
download | external_llvm-e0b436ac41a00bc210163964d3cf393c8b487c9e.tar.gz external_llvm-e0b436ac41a00bc210163964d3cf393c8b487c9e.tar.bz2 external_llvm-e0b436ac41a00bc210163964d3cf393c8b487c9e.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/Transforms/Scalar')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
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); |