From 8bd52286d30ee0f205e66181fe02133830f324b0 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Wed, 19 Apr 2017 16:22:19 +0000 Subject: use 'auto' with 'dyn_cast' and fix formatting; NFC llvm-svn: 300713 --- llvm/lib/IR/Instructions.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'llvm/lib/IR/Instructions.cpp') diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp index c10c144122e..76582e334d1 100644 --- a/llvm/lib/IR/Instructions.cpp +++ b/llvm/lib/IR/Instructions.cpp @@ -1855,7 +1855,7 @@ bool ShuffleVectorInst::isValidOperands(const Value *V1, const Value *V2, return false; // Mask must be vector of i32. - VectorType *MaskTy = dyn_cast(Mask->getType()); + auto *MaskTy = dyn_cast(Mask->getType()); if (!MaskTy || !MaskTy->getElementType()->isIntegerTy(32)) return false; @@ -1863,10 +1863,10 @@ bool ShuffleVectorInst::isValidOperands(const Value *V1, const Value *V2, if (isa(Mask) || isa(Mask)) return true; - if (const ConstantVector *MV = dyn_cast(Mask)) { + if (const auto *MV = dyn_cast(Mask)) { unsigned V1Size = cast(V1->getType())->getNumElements(); for (Value *Op : MV->operands()) { - if (ConstantInt *CI = dyn_cast(Op)) { + if (auto *CI = dyn_cast(Op)) { if (CI->uge(V1Size*2)) return false; } else if (!isa(Op)) { @@ -1876,8 +1876,7 @@ bool ShuffleVectorInst::isValidOperands(const Value *V1, const Value *V2, return true; } - if (const ConstantDataSequential *CDS = - dyn_cast(Mask)) { + if (const auto *CDS = dyn_cast(Mask)) { unsigned V1Size = cast(V1->getType())->getNumElements(); for (unsigned i = 0, e = MaskTy->getNumElements(); i != e; ++i) if (CDS->getElementAsInteger(i) >= V1Size*2) @@ -1889,7 +1888,7 @@ bool ShuffleVectorInst::isValidOperands(const Value *V1, const Value *V2, // used as the shuffle mask. When this occurs, the shuffle mask will // fall into this case and fail. To avoid this error, do this bit of // ugliness to allow such a mask pass. - if (const ConstantExpr *CE = dyn_cast(Mask)) + if (const auto *CE = dyn_cast(Mask)) if (CE->getOpcode() == Instruction::UserOp1) return true; @@ -1898,7 +1897,7 @@ bool ShuffleVectorInst::isValidOperands(const Value *V1, const Value *V2, int ShuffleVectorInst::getMaskValue(Constant *Mask, unsigned i) { assert(i < Mask->getType()->getVectorNumElements() && "Index out of range"); - if (ConstantDataSequential *CDS =dyn_cast(Mask)) + if (auto *CDS = dyn_cast(Mask)) return CDS->getElementAsInteger(i); Constant *C = Mask->getAggregateElement(i); if (isa(C)) @@ -1910,7 +1909,7 @@ void ShuffleVectorInst::getShuffleMask(Constant *Mask, SmallVectorImpl &Result) { unsigned NumElts = Mask->getType()->getVectorNumElements(); - if (ConstantDataSequential *CDS=dyn_cast(Mask)) { + if (auto *CDS = dyn_cast(Mask)) { for (unsigned i = 0; i != NumElts; ++i) Result.push_back(CDS->getElementAsInteger(i)); return; -- cgit v1.2.3