summaryrefslogtreecommitdiff
path: root/lib/IR/Instructions.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2014-03-10 15:03:06 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2014-03-10 15:03:06 +0000
commit6e9eeab69f0ce496d0120f9718e026f319d2ab01 (patch)
treef389bfb8de421b8380413c1f04454c2dbbea203c /lib/IR/Instructions.cpp
parente1820a6a4e5cfd1a41bd40ce6c21635d04289fec (diff)
downloadllvm-6e9eeab69f0ce496d0120f9718e026f319d2ab01.tar.gz
llvm-6e9eeab69f0ce496d0120f9718e026f319d2ab01.tar.bz2
llvm-6e9eeab69f0ce496d0120f9718e026f319d2ab01.tar.xz
[C++11] Modernize the IR library a bit.
No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203465 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR/Instructions.cpp')
-rw-r--r--lib/IR/Instructions.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/IR/Instructions.cpp b/lib/IR/Instructions.cpp
index c3a34a2ccd..d874411ccd 100644
--- a/lib/IR/Instructions.cpp
+++ b/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