[llvm] r300713 - use 'auto' with 'dyn_cast' and fix formatting; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 19 09:22:19 PDT 2017
Author: spatel
Date: Wed Apr 19 11:22:19 2017
New Revision: 300713
URL: http://llvm.org/viewvc/llvm-project?rev=300713&view=rev
Log:
use 'auto' with 'dyn_cast' and fix formatting; NFC
Modified:
llvm/trunk/lib/IR/Instructions.cpp
Modified: llvm/trunk/lib/IR/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Instructions.cpp?rev=300713&r1=300712&r2=300713&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Instructions.cpp (original)
+++ llvm/trunk/lib/IR/Instructions.cpp Wed Apr 19 11:22:19 2017
@@ -1855,7 +1855,7 @@ bool ShuffleVectorInst::isValidOperands(
return false;
// Mask must be vector of i32.
- VectorType *MaskTy = dyn_cast<VectorType>(Mask->getType());
+ auto *MaskTy = dyn_cast<VectorType>(Mask->getType());
if (!MaskTy || !MaskTy->getElementType()->isIntegerTy(32))
return false;
@@ -1863,10 +1863,10 @@ bool ShuffleVectorInst::isValidOperands(
if (isa<UndefValue>(Mask) || isa<ConstantAggregateZero>(Mask))
return true;
- if (const ConstantVector *MV = dyn_cast<ConstantVector>(Mask)) {
+ if (const auto *MV = dyn_cast<ConstantVector>(Mask)) {
unsigned V1Size = cast<VectorType>(V1->getType())->getNumElements();
for (Value *Op : MV->operands()) {
- if (ConstantInt *CI = dyn_cast<ConstantInt>(Op)) {
+ if (auto *CI = dyn_cast<ConstantInt>(Op)) {
if (CI->uge(V1Size*2))
return false;
} else if (!isa<UndefValue>(Op)) {
@@ -1876,8 +1876,7 @@ bool ShuffleVectorInst::isValidOperands(
return true;
}
- if (const ConstantDataSequential *CDS =
- dyn_cast<ConstantDataSequential>(Mask)) {
+ if (const auto *CDS = dyn_cast<ConstantDataSequential>(Mask)) {
unsigned V1Size = cast<VectorType>(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(
// 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<ConstantExpr>(Mask))
+ if (const auto *CE = dyn_cast<ConstantExpr>(Mask))
if (CE->getOpcode() == Instruction::UserOp1)
return true;
@@ -1898,7 +1897,7 @@ bool ShuffleVectorInst::isValidOperands(
int ShuffleVectorInst::getMaskValue(Constant *Mask, unsigned i) {
assert(i < Mask->getType()->getVectorNumElements() && "Index out of range");
- if (ConstantDataSequential *CDS =dyn_cast<ConstantDataSequential>(Mask))
+ if (auto *CDS = dyn_cast<ConstantDataSequential>(Mask))
return CDS->getElementAsInteger(i);
Constant *C = Mask->getAggregateElement(i);
if (isa<UndefValue>(C))
@@ -1910,7 +1909,7 @@ void ShuffleVectorInst::getShuffleMask(C
SmallVectorImpl<int> &Result) {
unsigned NumElts = Mask->getType()->getVectorNumElements();
- if (ConstantDataSequential *CDS=dyn_cast<ConstantDataSequential>(Mask)) {
+ if (auto *CDS = dyn_cast<ConstantDataSequential>(Mask)) {
for (unsigned i = 0; i != NumElts; ++i)
Result.push_back(CDS->getElementAsInteger(i));
return;
More information about the llvm-commits
mailing list