@@ -1041,9 +1041,10 @@ unsigned MachineInstr::getBundleSize() const {
1041
1041
// / Returns true if the MachineInstr has an implicit-use operand of exactly
1042
1042
// / the given register (not considering sub/super-registers).
1043
1043
bool MachineInstr::hasRegisterImplicitUseOperand (Register Reg) const {
1044
- for (const MachineOperand &MO : all_uses ())
1045
- if (MO.isImplicit () && MO.getReg () == Reg)
1044
+ for (const MachineOperand &MO : operands ()) {
1045
+ if (MO.isReg () && MO. isUse () && MO. isImplicit () && MO.getReg () == Reg)
1046
1046
return true ;
1047
+ }
1047
1048
return false ;
1048
1049
}
1049
1050
@@ -1263,8 +1264,10 @@ unsigned MachineInstr::findTiedOperandIdx(unsigned OpIdx) const {
1263
1264
// / clearKillInfo - Clears kill flags on all operands.
1264
1265
// /
1265
1266
void MachineInstr::clearKillInfo () {
1266
- for (MachineOperand &MO : all_uses ())
1267
- MO.setIsKill (false );
1267
+ for (MachineOperand &MO : operands ()) {
1268
+ if (MO.isReg () && MO.isUse ())
1269
+ MO.setIsKill (false );
1270
+ }
1268
1271
}
1269
1272
1270
1273
void MachineInstr::substituteRegister (Register FromReg, Register ToReg,
@@ -1546,9 +1549,12 @@ bool MachineInstr::isLoadFoldBarrier() const {
1546
1549
// / allDefsAreDead - Return true if all the defs of this instruction are dead.
1547
1550
// /
1548
1551
bool MachineInstr::allDefsAreDead () const {
1549
- for (const MachineOperand &MO : all_defs ())
1552
+ for (const MachineOperand &MO : operands ()) {
1553
+ if (!MO.isReg () || MO.isUse ())
1554
+ continue ;
1550
1555
if (!MO.isDead ())
1551
1556
return false ;
1557
+ }
1552
1558
return true ;
1553
1559
}
1554
1560
@@ -2057,8 +2063,8 @@ void MachineInstr::clearRegisterKills(Register Reg,
2057
2063
const TargetRegisterInfo *RegInfo) {
2058
2064
if (!Reg.isPhysical ())
2059
2065
RegInfo = nullptr ;
2060
- for (MachineOperand &MO : all_uses ()) {
2061
- if (!MO.isKill ())
2066
+ for (MachineOperand &MO : operands ()) {
2067
+ if (!MO.isReg () || !MO. isUse () || !MO. isKill ())
2062
2068
continue ;
2063
2069
Register OpReg = MO.getReg ();
2064
2070
if ((RegInfo && RegInfo->regsOverlap (Reg, OpReg)) || Reg == OpReg)
0 commit comments