From 5ca2ec65bd52c61fade8b81c37ad95098ddaaa8e Mon Sep 17 00:00:00 2001 From: Mon P Wang Date: Thu, 6 Nov 2008 22:52:21 +0000 Subject: Fixed scalarizing an extract subvector and prevent an infinite loop when simplify a vector. llvm-svn: 58820 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'llvm/lib/Transforms/Scalar/InstructionCombining.cpp') diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 3210b12cbb9..743d8bb15f7 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -1410,6 +1410,12 @@ Value *InstCombiner::SimplifyDemandedVectorElts(Value *V, uint64_t DemandedElts, } else if (isa(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(V->getType())->getElementType(); Constant *Zero = Constant::getNullValue(EltTy); Constant *Undef = UndefValue::get(EltTy); -- cgit v1.2.3