vporpo 21dad8e5cc
[AMDGPU] Improve crash message when S_WAITCNT_DEPCTR is missing its operand (#177065)
The code in the test is causing a crash in `SIInstrInfo.cpp`
`fixImplicitOperands()` in `MI.implicit_operands()`:
```
  for (auto &Op : MI.implicit_operands()) {
```
MachineInstr.h:
```
  mop_range implicit_operands() {
=>  return operands_impl().drop_front(getNumExplicitOperands());
  }
```
We are trying to drop 1 operand from the operands of MI which are 0.

By early returning we are no longer crashing at that point and we are
getting a more meaningful error message:

```
*** Bad machine code: Too few operands ***
- function:    missing_operand_crash
- basic block: %bb.0  (0x5a9d30ced988)
- instruction: S_WAITCNT_DEPCTR
1 operands expected, but 0 given.
```

The code is still crashing at a different location, but at least we are
getting an error message.
2026-01-26 08:35:30 -08:00
..