[PATCH] D100281: [AMDGPU] Revise handling of preexisting waitcnt

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 28 06:35:54 PDT 2021


foad added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp:725
   const unsigned UB = getScoreUB(T);
-  if (Count < UB && UB - Count > LB)
-    return true;
-
-  Count = ~0u;
-  return false;
+  if (Count >= UB || UB - Count <= LB)
+    Count = ~0u;
----------------
This condition was already pretty obscure and inverting it has made it even more obscure. Instead, how about:
```
  assert(LB <= UB); // does this even need an assert, or is it blatantly obvious?
  if (Count >= UB - LB)
    ...
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100281



More information about the llvm-commits mailing list