VecUtils: Clean up uses of dyn_cast.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179936 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer
2013-04-20 10:36:17 +00:00
parent 6fe5cc49d8
commit d760c08b34

View File

@@ -557,7 +557,7 @@ Value *BoUpSLP::vectorizeTree_rec(ArrayRef<Value *> VL, int VF) {
bool AllConst = true; bool AllConst = true;
bool AllSameScalar = true; bool AllSameScalar = true;
for (unsigned i = 0, e = VF; i < e; ++i) { for (unsigned i = 0, e = VF; i < e; ++i) {
AllConst &= !!dyn_cast<Constant>(VL[i]); AllConst &= isa<Constant>(VL[i]);
AllSameScalar &= (VL[0] == VL[i]); AllSameScalar &= (VL[0] == VL[i]);
// The instruction must be in the same BB, and it must be vectorizable. // The instruction must be in the same BB, and it must be vectorizable.
Instruction *I = dyn_cast<Instruction>(VL[i]); Instruction *I = dyn_cast<Instruction>(VL[i]);
@@ -609,13 +609,13 @@ Value *BoUpSLP::vectorizeTree_rec(ArrayRef<Value *> VL, int VF) {
Value *RHS = vectorizeTree_rec(RHSVL, VF); Value *RHS = vectorizeTree_rec(RHSVL, VF);
Value *LHS = vectorizeTree_rec(LHSVL, VF); Value *LHS = vectorizeTree_rec(LHSVL, VF);
IRBuilder<> Builder(GetLastInstr(VL, VF)); IRBuilder<> Builder(GetLastInstr(VL, VF));
BinaryOperator *BinOp = dyn_cast<BinaryOperator>(VL0); BinaryOperator *BinOp = cast<BinaryOperator>(VL0);
Value *V = Builder.CreateBinOp(BinOp->getOpcode(), RHS,LHS); Value *V = Builder.CreateBinOp(BinOp->getOpcode(), RHS,LHS);
VectorizedValues[VL0] = V; VectorizedValues[VL0] = V;
return V; return V;
} }
case Instruction::Load: { case Instruction::Load: {
LoadInst *LI = dyn_cast<LoadInst>(VL0); LoadInst *LI = cast<LoadInst>(VL0);
unsigned Alignment = LI->getAlignment(); unsigned Alignment = LI->getAlignment();
// Check if all of the loads are consecutive. // Check if all of the loads are consecutive.
@@ -632,7 +632,7 @@ Value *BoUpSLP::vectorizeTree_rec(ArrayRef<Value *> VL, int VF) {
return LI; return LI;
} }
case Instruction::Store: { case Instruction::Store: {
StoreInst *SI = dyn_cast<StoreInst>(VL0); StoreInst *SI = cast<StoreInst>(VL0);
unsigned Alignment = SI->getAlignment(); unsigned Alignment = SI->getAlignment();
ValueList ValueOp; ValueList ValueOp;