1//===- InstCombineVectorOps.cpp -------------------------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 11 unchanged lines hidden (view full) --- 20/// CheapToScalarize - Return true if the value is cheaper to scalarize than it 21/// is to leave as a vector operation. isConstant indicates whether we're 22/// extracting one known element. If false we're extracting a variable index. 23static bool CheapToScalarize(Value *V, bool isConstant) { 24 if (Constant *C = dyn_cast<Constant>(V)) { 25 if (isConstant) return true; 26 27 // If all elts are the same, we can extract it and use any of the values. |
28 if (Constant *Op0 = C->getAggregateElement(0U)) { 29 for (unsigned i = 1, e = V->getType()->getVectorNumElements(); i != e; 30 ++i) 31 if (C->getAggregateElement(i) != Op0) 32 return false; 33 return true; 34 } |
35 } 36 Instruction *I = dyn_cast<Instruction>(V); 37 if (!I) return false; 38 39 // Insert element gets simplified to the inserted element or is deleted if 40 // this is constant idx extract element and its a constant idx insertelt. 41 if (I->getOpcode() == Instruction::InsertElement && isConstant && 42 isa<ConstantInt>(I->getOperand(2))) --- 1006 unchanged lines hidden --- |