Clean up indentation and other whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117728 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bob Wilson 2010-10-29 22:20:45 +00:00
parent 09fd64644d
commit db1da8ed42

View File

@ -190,11 +190,11 @@ Instruction *InstCombiner::visitExtractElementInst(ExtractElementInst &EI) {
if (I->hasOneUse() && if (I->hasOneUse() &&
CheapToScalarize(BO, isa<ConstantInt>(EI.getOperand(1)))) { CheapToScalarize(BO, isa<ConstantInt>(EI.getOperand(1)))) {
Value *newEI0 = Value *newEI0 =
Builder->CreateExtractElement(BO->getOperand(0), EI.getOperand(1), Builder->CreateExtractElement(BO->getOperand(0), EI.getOperand(1),
EI.getName()+".lhs"); EI.getName()+".lhs");
Value *newEI1 = Value *newEI1 =
Builder->CreateExtractElement(BO->getOperand(1), EI.getOperand(1), Builder->CreateExtractElement(BO->getOperand(1), EI.getOperand(1),
EI.getName()+".rhs"); EI.getName()+".rhs");
return BinaryOperator::Create(BO->getOpcode(), newEI0, newEI1); return BinaryOperator::Create(BO->getOpcode(), newEI0, newEI1);
} }
} else if (InsertElementInst *IE = dyn_cast<InsertElementInst>(I)) { } else if (InsertElementInst *IE = dyn_cast<InsertElementInst>(I)) {
@ -340,7 +340,7 @@ static Value *CollectShuffleElements(Value *V, std::vector<Constant*> &Mask,
if (isa<ConstantInt>(EI->getOperand(1)) && isa<ConstantInt>(IdxOp) && if (isa<ConstantInt>(EI->getOperand(1)) && isa<ConstantInt>(IdxOp) &&
EI->getOperand(0)->getType() == V->getType()) { EI->getOperand(0)->getType() == V->getType()) {
unsigned ExtractedIdx = unsigned ExtractedIdx =
cast<ConstantInt>(EI->getOperand(1))->getZExtValue(); cast<ConstantInt>(EI->getOperand(1))->getZExtValue();
unsigned InsertedIdx = cast<ConstantInt>(IdxOp)->getZExtValue(); unsigned InsertedIdx = cast<ConstantInt>(IdxOp)->getZExtValue();
// Either the extracted from or inserted into vector must be RHSVec, // Either the extracted from or inserted into vector must be RHSVec,
@ -349,8 +349,8 @@ static Value *CollectShuffleElements(Value *V, std::vector<Constant*> &Mask,
RHS = EI->getOperand(0); RHS = EI->getOperand(0);
Value *V = CollectShuffleElements(VecOp, Mask, RHS); Value *V = CollectShuffleElements(VecOp, Mask, RHS);
Mask[InsertedIdx % NumElts] = Mask[InsertedIdx % NumElts] =
ConstantInt::get(Type::getInt32Ty(V->getContext()), ConstantInt::get(Type::getInt32Ty(V->getContext()),
NumElts+ExtractedIdx); NumElts+ExtractedIdx);
return V; return V;
} }
@ -396,7 +396,7 @@ Instruction *InstCombiner::visitInsertElementInst(InsertElementInst &IE) {
EI->getOperand(0)->getType() == IE.getType()) { EI->getOperand(0)->getType() == IE.getType()) {
unsigned NumVectorElts = IE.getType()->getNumElements(); unsigned NumVectorElts = IE.getType()->getNumElements();
unsigned ExtractedIdx = unsigned ExtractedIdx =
cast<ConstantInt>(EI->getOperand(1))->getZExtValue(); cast<ConstantInt>(EI->getOperand(1))->getZExtValue();
unsigned InsertedIdx = cast<ConstantInt>(IdxOp)->getZExtValue(); unsigned InsertedIdx = cast<ConstantInt>(IdxOp)->getZExtValue();
if (ExtractedIdx >= NumVectorElts) // Out of range extract. if (ExtractedIdx >= NumVectorElts) // Out of range extract.
@ -418,8 +418,7 @@ Instruction *InstCombiner::visitInsertElementInst(InsertElementInst &IE) {
Value *LHS = CollectShuffleElements(&IE, Mask, RHS); Value *LHS = CollectShuffleElements(&IE, Mask, RHS);
if (RHS == 0) RHS = UndefValue::get(LHS->getType()); if (RHS == 0) RHS = UndefValue::get(LHS->getType());
// We now have a shuffle of LHS, RHS, Mask. // We now have a shuffle of LHS, RHS, Mask.
return new ShuffleVectorInst(LHS, RHS, return new ShuffleVectorInst(LHS, RHS, ConstantVector::get(Mask));
ConstantVector::get(Mask));
} }
} }
} }
@ -561,4 +560,3 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
return MadeChange ? &SVI : 0; return MadeChange ? &SVI : 0;
} }