Skip to content

Commit 0b0cc23

Browse files
committedMay 15, 2019
[mips] Use range-based for loops. NFC
llvm-svn: 360817
1 parent 814435f commit 0b0cc23

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed
 

‎llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp

+17-20
Original file line numberDiff line numberDiff line change
@@ -492,14 +492,12 @@ MemDefsUses::MemDefsUses(const DataLayout &DL, const MachineFrameInfo *MFI_)
492492

493493
bool MemDefsUses::hasHazard_(const MachineInstr &MI) {
494494
bool HasHazard = false;
495-
SmallVector<ValueType, 4> Objs;
496495

497496
// Check underlying object list.
497+
SmallVector<ValueType, 4> Objs;
498498
if (getUnderlyingObjects(MI, Objs)) {
499-
for (SmallVectorImpl<ValueType>::const_iterator I = Objs.begin();
500-
I != Objs.end(); ++I)
501-
HasHazard |= updateDefsUses(*I, MI.mayStore());
502-
499+
for (ValueType VT : Objs)
500+
HasHazard |= updateDefsUses(VT, MI.mayStore());
503501
return HasHazard;
504502
}
505503

@@ -525,33 +523,32 @@ bool MemDefsUses::updateDefsUses(ValueType V, bool MayStore) {
525523
bool MemDefsUses::
526524
getUnderlyingObjects(const MachineInstr &MI,
527525
SmallVectorImpl<ValueType> &Objects) const {
528-
if (!MI.hasOneMemOperand() ||
529-
(!(*MI.memoperands_begin())->getValue() &&
530-
!(*MI.memoperands_begin())->getPseudoValue()))
526+
if (!MI.hasOneMemOperand())
531527
return false;
532528

533-
if (const PseudoSourceValue *PSV =
534-
(*MI.memoperands_begin())->getPseudoValue()) {
529+
auto & MMO = **MI.memoperands_begin();
530+
531+
if (const PseudoSourceValue *PSV = MMO.getPseudoValue()) {
535532
if (!PSV->isAliased(MFI))
536533
return false;
537534
Objects.push_back(PSV);
538535
return true;
539536
}
540537

541-
const Value *V = (*MI.memoperands_begin())->getValue();
538+
if (const Value *V = MMO.getValue()) {
539+
SmallVector<const Value *, 4> Objs;
540+
GetUnderlyingObjects(V, Objs, DL);
542541

543-
SmallVector<const Value *, 4> Objs;
544-
GetUnderlyingObjects(V, Objs, DL);
542+
for (const Value *UValue : Objs) {
543+
if (!isIdentifiedObject(V))
544+
return false;
545545

546-
for (SmallVectorImpl<const Value *>::iterator I = Objs.begin(), E = Objs.end();
547-
I != E; ++I) {
548-
if (!isIdentifiedObject(V))
549-
return false;
550-
551-
Objects.push_back(*I);
546+
Objects.push_back(UValue);
547+
}
548+
return true;
552549
}
553550

554-
return true;
551+
return false;
555552
}
556553

557554
// Replace Branch with the compact branch instruction.

0 commit comments

Comments
 (0)
Please sign in to comment.