Skip to content

Commit a62e5c8

Browse files
committed
Consistent with downstream
Change-Id: I56ec0c004b941678bc5538b6eca5f02db5e1712e
1 parent 23d28ff commit a62e5c8

File tree

1 file changed

+26
-24
lines changed

1 file changed

+26
-24
lines changed

llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,9 @@ int GCNHazardRecognizer::checkVALUHazards(MachineInstr *VALU) {
982982
const MachineOperand *ForwardedDst = getDstSelForwardingOperand(MI, ST);
983983
if (ForwardedDst) {
984984
return consumesDstSelForwardingOperand(VALU, ForwardedDst, TRI);
985-
} else if (MI.isInlineAsm()) {
985+
}
986+
987+
if (MI.isInlineAsm()) {
986988
// Assume inline asm has dst forwarding hazard
987989
for (auto &Def : MI.all_defs()) {
988990
if (consumesDstSelForwardingOperand(VALU, &Def, TRI))
@@ -1098,35 +1100,35 @@ int GCNHazardRecognizer::checkInlineAsmHazards(MachineInstr *IA) {
10981100
WaitStatesNeeded =
10991101
std::max(WaitStatesNeeded, checkVALUHazardsHelper(Op, MRI));
11001102
}
1103+
}
1104+
}
11011105

1102-
if (ST.hasDstSelForwardingHazard()) {
1103-
const int Shift16DefWaitstates = 1;
1106+
if (ST.hasDstSelForwardingHazard()) {
1107+
const int Shift16DefWaitstates = 1;
11041108

1105-
auto IsShift16BitDefFn = [this, &IA](const MachineInstr &MI) {
1106-
const MachineOperand *Dst = getDstSelForwardingOperand(MI, ST);
1107-
// Assume inline asm reads the dst
1108-
if (Dst)
1109-
return true;
1109+
auto IsShift16BitDefFn = [this, &IA](const MachineInstr &MI) {
1110+
const MachineOperand *Dst = getDstSelForwardingOperand(MI, ST);
1111+
// Assume inline asm reads the dst
1112+
if (Dst)
1113+
return true;
11101114

1111-
if (MI.isInlineAsm()) {
1112-
// If MI is inline asm, assume it has dst forwarding hazard
1113-
for (auto &Op :
1114-
drop_begin(MI.operands(), InlineAsm::MIOp_FirstOperand)) {
1115-
if (Op.isReg() && IA->modifiesRegister(Op.getReg(), &TRI)) {
1116-
return true;
1117-
}
1118-
}
1115+
if (MI.isInlineAsm()) {
1116+
// If MI is inline asm, assume it has dst forwarding hazard
1117+
for (auto &Op :
1118+
drop_begin(MI.operands(), InlineAsm::MIOp_FirstOperand)) {
1119+
if (Op.isReg() && IA->modifiesRegister(Op.getReg(), &TRI)) {
1120+
return true;
11191121
}
1122+
}
1123+
}
11201124

1121-
return false;
1122-
};
1125+
return false;
1126+
};
11231127

1124-
int WaitStatesNeededForDef =
1125-
Shift16DefWaitstates -
1126-
getWaitStatesSince(IsShift16BitDefFn, Shift16DefWaitstates);
1127-
WaitStatesNeeded = std::max(WaitStatesNeeded, WaitStatesNeededForDef);
1128-
}
1129-
}
1128+
int WaitStatesNeededForDef =
1129+
Shift16DefWaitstates -
1130+
getWaitStatesSince(IsShift16BitDefFn, Shift16DefWaitstates);
1131+
WaitStatesNeeded = std::max(WaitStatesNeeded, WaitStatesNeededForDef);
11301132
}
11311133

11321134
return WaitStatesNeeded;

0 commit comments

Comments
 (0)