[PATCH] D156679: [WIP][AMDGPU][SIInsertWaitcnts] Do not add s_waitcnt when the counters are known to be 0 already

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 24 08:13:00 PDT 2023


arsenm added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/SIInstrInfo.cpp:8291-8293
+  // FIXME: move to the right place
+  if (auto NonSoftOpcode = SIInstrInfo::getNonSoftWaitcntOpcode(Opcode))
+    Opcode = *NonSoftOpcode;
----------------
This should use PseudoInstExpansion (which we apparently only have 2 uses of, I thought there were more)


================
Comment at: llvm/lib/Target/AMDGPU/SIInstrInfo.h:843
 
+  static std::optional<unsigned> getNonSoftWaitcntOpcode(unsigned Op) {
+    if (Op == AMDGPU::S_WAITCNT || Op == AMDGPU::S_WAITCNT_soft)
----------------
don't use optional for this. I would assume this is just invalid to call for a non-waitcnt


================
Comment at: llvm/lib/Target/AMDGPU/SIInstrInfo.h:863
+
+  static bool isSoftWaitcnt(const MachineInstr &MI) {
+    unsigned Op = MI.getOpcode();
----------------
Document what a soft waitcnt is


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156679/new/

https://reviews.llvm.org/D156679



More information about the llvm-commits mailing list