@@ -492,14 +492,12 @@ MemDefsUses::MemDefsUses(const DataLayout &DL, const MachineFrameInfo *MFI_)
492
492
493
493
bool MemDefsUses::hasHazard_ (const MachineInstr &MI) {
494
494
bool HasHazard = false ;
495
- SmallVector<ValueType, 4 > Objs;
496
495
497
496
// Check underlying object list.
497
+ SmallVector<ValueType, 4 > Objs;
498
498
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 ());
503
501
return HasHazard;
504
502
}
505
503
@@ -525,33 +523,32 @@ bool MemDefsUses::updateDefsUses(ValueType V, bool MayStore) {
525
523
bool MemDefsUses::
526
524
getUnderlyingObjects (const MachineInstr &MI,
527
525
SmallVectorImpl<ValueType> &Objects) const {
528
- if (!MI.hasOneMemOperand () ||
529
- (!(*MI.memoperands_begin ())->getValue () &&
530
- !(*MI.memoperands_begin ())->getPseudoValue ()))
526
+ if (!MI.hasOneMemOperand ())
531
527
return false ;
532
528
533
- if (const PseudoSourceValue *PSV =
534
- (*MI.memoperands_begin ())->getPseudoValue ()) {
529
+ auto & MMO = **MI.memoperands_begin ();
530
+
531
+ if (const PseudoSourceValue *PSV = MMO.getPseudoValue ()) {
535
532
if (!PSV->isAliased (MFI))
536
533
return false ;
537
534
Objects.push_back (PSV);
538
535
return true ;
539
536
}
540
537
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);
542
541
543
- SmallVector<const Value *, 4 > Objs;
544
- GetUnderlyingObjects (V, Objs, DL);
542
+ for (const Value *UValue : Objs) {
543
+ if (!isIdentifiedObject (V))
544
+ return false ;
545
545
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 ;
552
549
}
553
550
554
- return true ;
551
+ return false ;
555
552
}
556
553
557
554
// Replace Branch with the compact branch instruction.
0 commit comments