[llvm] [AMDGPU] Correctly insert s_nops for dst forwarding hazard (PR #100276)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 19 13:07:42 PDT 2024
================
@@ -1098,35 +1100,35 @@ int GCNHazardRecognizer::checkInlineAsmHazards(MachineInstr *IA) {
WaitStatesNeeded =
std::max(WaitStatesNeeded, checkVALUHazardsHelper(Op, MRI));
}
+ }
+ }
- if (ST.hasDstSelForwardingHazard()) {
- const int Shift16DefWaitstates = 1;
+ if (ST.hasDstSelForwardingHazard()) {
+ const int Shift16DefWaitstates = 1;
- auto IsShift16BitDefFn = [this, &IA](const MachineInstr &MI) {
- const MachineOperand *Dst = getDstSelForwardingOperand(MI, ST);
- // Assume inline asm reads the dst
- if (Dst)
- return true;
+ auto IsShift16BitDefFn = [this, &IA](const MachineInstr &MI) {
+ const MachineOperand *Dst = getDstSelForwardingOperand(MI, ST);
+ // Assume inline asm reads the dst
+ if (Dst)
+ return true;
- if (MI.isInlineAsm()) {
- // If MI is inline asm, assume it has dst forwarding hazard
- for (auto &Op :
- drop_begin(MI.operands(), InlineAsm::MIOp_FirstOperand)) {
- if (Op.isReg() && IA->modifiesRegister(Op.getReg(), &TRI)) {
- return true;
- }
- }
+ if (MI.isInlineAsm()) {
+ // If MI is inline asm, assume it has dst forwarding hazard
+ for (auto &Op :
+ drop_begin(MI.operands(), InlineAsm::MIOp_FirstOperand)) {
+ if (Op.isReg() && IA->modifiesRegister(Op.getReg(), &TRI)) {
+ return true;
}
----------------
arsenm wrote:
You should just need to call modifiesRegister once on the instruction, with one register. Not for every register operated
https://github.com/llvm/llvm-project/pull/100276
More information about the llvm-commits
mailing list