basic instcombine support for CDS.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148806 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2012-01-24 14:31:22 +00:00
parent 29cc6cb4d1
commit bec2d03c4d
2 changed files with 32 additions and 14 deletions

View File

@ -16,7 +16,8 @@
using namespace llvm;
/// CheapToScalarize - Return true if the value is cheaper to scalarize than it
/// is to leave as a vector operation.
/// is to leave as a vector operation. isConstant indicates whether we're
/// extracting one known element. If false we're extracting a variable index.
static bool CheapToScalarize(Value *V, bool isConstant) {
if (isa<ConstantAggregateZero>(V))
return true;
@ -335,10 +336,14 @@ static Value *CollectShuffleElements(Value *V, std::vector<Constant*> &Mask,
if (isa<UndefValue>(V)) {
Mask.assign(NumElts, UndefValue::get(Type::getInt32Ty(V->getContext())));
return V;
} else if (isa<ConstantAggregateZero>(V)) {
}
if (isa<ConstantAggregateZero>(V)) {
Mask.assign(NumElts, ConstantInt::get(Type::getInt32Ty(V->getContext()),0));
return V;
} else if (InsertElementInst *IEI = dyn_cast<InsertElementInst>(V)) {
}
if (InsertElementInst *IEI = dyn_cast<InsertElementInst>(V)) {
// If this is an insert of an extract from some other vector, include it.
Value *VecOp = IEI->getOperand(0);
Value *ScalarOp = IEI->getOperand(1);