Use range for

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208617 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Matt Arsenault 2014-05-12 19:23:21 +00:00
parent 2f5f1c2ccb
commit 76aa42c199
2 changed files with 4 additions and 6 deletions

View File

@ -1811,8 +1811,7 @@ FoldOperand(SDNode *ParentNode, unsigned SrcIdx, SDValue &Src, SDValue &Neg,
TII->getOperandIdx(Opcode, AMDGPU::OpName::src1_W) TII->getOperandIdx(Opcode, AMDGPU::OpName::src1_W)
}; };
std::vector<unsigned> Consts; std::vector<unsigned> Consts;
for (unsigned i = 0; i < sizeof(SrcIndices) / sizeof(int); i++) { for (int OtherSrcIdx : SrcIndices) {
int OtherSrcIdx = SrcIndices[i];
int OtherSelIdx = TII->getSelIdx(Opcode, OtherSrcIdx); int OtherSelIdx = TII->getSelIdx(Opcode, OtherSrcIdx);
if (OtherSrcIdx < 0 || OtherSelIdx < 0) if (OtherSrcIdx < 0 || OtherSelIdx < 0)
continue; continue;

View File

@ -71,10 +71,9 @@ const TargetRegisterClass *SIRegisterInfo::getPhysRegClass(unsigned Reg) const {
&AMDGPU::SReg_256RegClass &AMDGPU::SReg_256RegClass
}; };
for (unsigned i = 0, e = sizeof(BaseClasses) / for (const TargetRegisterClass *BaseClass : BaseClasses) {
sizeof(const TargetRegisterClass*); i != e; ++i) { if (BaseClass->contains(Reg)) {
if (BaseClasses[i]->contains(Reg)) { return BaseClass;
return BaseClasses[i];
} }
} }
return nullptr; return nullptr;