diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2014-03-10 15:03:06 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2014-03-10 15:03:06 +0000 |
commit | 3ad5c96268db965191ec71cdcb6d8884f6fca99c (patch) | |
tree | fe813004837e99b1a2bdad22ab235a00530835dd /llvm/lib/IR/Instructions.cpp | |
parent | 059e4b158c272fbd15ba80f9b47ade2f2905d6e5 (diff) | |
download | llvm-3ad5c96268db965191ec71cdcb6d8884f6fca99c.zip llvm-3ad5c96268db965191ec71cdcb6d8884f6fca99c.tar.gz llvm-3ad5c96268db965191ec71cdcb6d8884f6fca99c.tar.bz2 |
[C++11] Modernize the IR library a bit.
No functionality change.
llvm-svn: 203465
Diffstat (limited to 'llvm/lib/IR/Instructions.cpp')
-rw-r--r-- | llvm/lib/IR/Instructions.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp index c3a34a2..d874411 100644 --- a/llvm/lib/IR/Instructions.cpp +++ b/llvm/lib/IR/Instructions.cpp @@ -1578,11 +1578,11 @@ bool ShuffleVectorInst::isValidOperands(const Value *V1, const Value *V2, if (const ConstantVector *MV = dyn_cast<ConstantVector>(Mask)) { unsigned V1Size = cast<VectorType>(V1->getType())->getNumElements(); - for (unsigned i = 0, e = MV->getNumOperands(); i != e; ++i) { - if (ConstantInt *CI = dyn_cast<ConstantInt>(MV->getOperand(i))) { + for (Value *Op : MV->operands()) { + if (ConstantInt *CI = dyn_cast<ConstantInt>(Op)) { if (CI->uge(V1Size*2)) return false; - } else if (!isa<UndefValue>(MV->getOperand(i))) { + } else if (!isa<UndefValue>(Op)) { return false; } } @@ -1702,8 +1702,7 @@ ExtractValueInst::ExtractValueInst(const ExtractValueInst &EVI) // Type *ExtractValueInst::getIndexedType(Type *Agg, ArrayRef<unsigned> Idxs) { - for (unsigned CurIdx = 0; CurIdx != Idxs.size(); ++CurIdx) { - unsigned Index = Idxs[CurIdx]; + for (unsigned Index : Idxs) { // We can't use CompositeType::indexValid(Index) here. // indexValid() always returns true for arrays because getelementptr allows // out-of-bounds indices. Since we don't allow those for extractvalue and |