[llvm] [AMDGPU] Make SGPR occupancy the exact inverse of getMaxNumSGPRs (PR #201342)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 3 08:20:44 PDT 2026


================
@@ -30,6 +30,9 @@ AMDGPUMCExpr::AMDGPUMCExpr(VariantKind Kind, ArrayRef<const MCExpr *> Args,
     : Kind(Kind), Ctx(Ctx) {
   assert(Args.size() >= 1 && "Needs a minimum of one expression.");
   assert(Kind != AGVK_None && "Cannot construct AMDGPUMCExpr of kind none.");
+  assert((getNumExpectedArgs(Kind) == 0 ||
+          Args.size() == getNumExpectedArgs(Kind)) &&
+         "Wrong number of operands for AMDGPUMCExpr kind.");
----------------
shiltian wrote:

```suggestion
         "wrong number of operands for AMDGPUMCExpr kind.");
```

https://github.com/llvm/llvm-project/pull/201342


More information about the llvm-commits mailing list