From cb5674b9c2e4d7944bd8fe0ed92f316e8e5d5f30 Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Tue, 26 Aug 2014 19:06:41 +0000 Subject: Revert r210342 and r210343, add test case for the crasher. PR 20642. llvm-svn: 216475 --- llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 91 ------------------------- 1 file changed, 91 deletions(-) (limited to 'llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp') diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index 2602feb2f2c..24c07139c6b 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -1179,54 +1179,6 @@ void BoUpSLP::buildTree_rec(ArrayRef VL, unsigned Depth) { } return; } - case Instruction::GetElementPtr: { - // We don't combine GEPs with complicated (nested) indexing. - for (unsigned j = 0; j < VL.size(); ++j) { - if (cast(VL[j])->getNumOperands() != 2) { - DEBUG(dbgs() << "SLP: not-vectorizable GEP (nested indexes).\n"); - BS.cancelScheduling(VL); - newTreeEntry(VL, false); - return; - } - } - - // We can't combine several GEPs into one vector if they operate on - // different types. - Type *Ty0 = cast(VL0)->getOperand(0)->getType(); - for (unsigned j = 0; j < VL.size(); ++j) { - Type *CurTy = cast(VL[j])->getOperand(0)->getType(); - if (Ty0 != CurTy) { - DEBUG(dbgs() << "SLP: not-vectorizable GEP (different types).\n"); - BS.cancelScheduling(VL); - newTreeEntry(VL, false); - return; - } - } - - // We don't combine GEPs with non-constant indexes. - for (unsigned j = 0; j < VL.size(); ++j) { - auto Op = cast(VL[j])->getOperand(1); - if (!isa(Op)) { - DEBUG( - dbgs() << "SLP: not-vectorizable GEP (non-constant indexes).\n"); - BS.cancelScheduling(VL); - newTreeEntry(VL, false); - return; - } - } - - newTreeEntry(VL, true); - DEBUG(dbgs() << "SLP: added a vector of GEPs.\n"); - for (unsigned i = 0, e = 2; i < e; ++i) { - ValueList Operands; - // Prepare the operand vector. - for (unsigned j = 0; j < VL.size(); ++j) - Operands.push_back(cast(VL[j])->getOperand(i)); - - buildTree_rec(Operands, Depth + 1); - } - return; - } case Instruction::Store: { // Check if the stores are consecutive or of we need to swizzle them. for (unsigned i = 0, e = VL.size() - 1; i < e; ++i) @@ -1464,20 +1416,6 @@ int BoUpSLP::getEntryCost(TreeEntry *E) { } return VecCost - ScalarCost; } - case Instruction::GetElementPtr: { - TargetTransformInfo::OperandValueKind Op1VK = - TargetTransformInfo::OK_AnyValue; - TargetTransformInfo::OperandValueKind Op2VK = - TargetTransformInfo::OK_UniformConstantValue; - - int ScalarCost = - VecTy->getNumElements() * - TTI->getArithmeticInstrCost(Instruction::Add, ScalarTy, Op1VK, Op2VK); - int VecCost = - TTI->getArithmeticInstrCost(Instruction::Add, VecTy, Op1VK, Op2VK); - - return VecCost - ScalarCost; - } case Instruction::Load: { // Cost of wide load - cost of scalar loads. int ScalarLdCost = VecTy->getNumElements() * @@ -2044,35 +1982,6 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) { ++NumVectorInstructions; return propagateMetadata(S, E->Scalars); } - case Instruction::GetElementPtr: { - setInsertPointAfterBundle(E->Scalars); - - ValueList Op0VL; - for (int i = 0, e = E->Scalars.size(); i < e; ++i) - Op0VL.push_back(cast(E->Scalars[i])->getOperand(0)); - - Value *Op0 = vectorizeTree(Op0VL); - - std::vector OpVecs; - for (int j = 1, e = cast(VL0)->getNumOperands(); j < e; - ++j) { - ValueList OpVL; - for (int i = 0, e = E->Scalars.size(); i < e; ++i) - OpVL.push_back(cast(E->Scalars[i])->getOperand(j)); - - Value *OpVec = vectorizeTree(OpVL); - OpVecs.push_back(OpVec); - } - - Value *V = Builder.CreateGEP(Op0, OpVecs); - E->VectorizedValue = V; - ++NumVectorInstructions; - - if (Instruction *I = dyn_cast(V)) - return propagateMetadata(I, E->Scalars); - - return V; - } case Instruction::Call: { CallInst *CI = cast(VL0); setInsertPointAfterBundle(E->Scalars); -- cgit v1.2.3