openjdk/jdk · warning

Warning: unused operand (%s)

Error message

Warning: unused operand (%s)

What it means

ADLC lint warning from ArchDesc's operand-usage check: an operand form is defined in the .ad file but never referenced by any instruction, encoding, or the built-in form-callback sweep (which pre-marks legacy vector forms like legVecS/D/X/Y/Z under #ifdef). Printed as '\nWarning: unused operand (<ident>)'; the build still succeeds.

Source

Thrown at src/hotspot/share/adlc/archDesc.cpp:776

#elif defined(AMD64)
  callback.do_form_by_name("vecS");
  callback.do_form_by_name("vecD");
  callback.do_form_by_name("vecX");
  callback.do_form_by_name("vecY");
  callback.do_form_by_name("vecZ");
  callback.do_form_by_name("legVecS");
  callback.do_form_by_name("legVecD");
  callback.do_form_by_name("legVecX");
  callback.do_form_by_name("legVecY");
  callback.do_form_by_name("legVecZ");
#endif

  int cnt = 0;
  _operands.reset();
  OperandForm* operand;
  for ( ; (operand = (OperandForm*)_operands.iter()) != nullptr; ) {
    if(visited.find(operand) == visited.end() && !operand->ideal_only()) {
      fprintf(stderr, "\nWarning: unused operand (%s)", operand->_ident);
      cnt++;
    }
  }
  if (cnt) fprintf(stderr, "\n-------Warning: total %d unused operands\n", cnt);

  return true;
}

void ArchDesc::dump() {
  _pre_header.dump();
  _header.dump();
  _source.dump();
  if (_register) _register->dump();
  fprintf(stderr,"\n");
  fprintf(stderr,"------------------ Dump Operands ---------------------\n");
  _operands.dump();
  fprintf(stderr,"\n");
  fprintf(stderr,"------------------ Dump Operand Classes --------------\n");

View on GitHub (pinned to 88dfb74bbe)

Solutions

  1. Remove the operand definition if it is truly dead
  2. Or reference it from the intended instruction/encode you were about to add
  3. Ignore for upstream-controlled files where the warning is pre-existing
Defensive patterns

Strategy: validation

Validate before calling

make adlc 2>&1 | grep -oP '(?<=Warning: unused operand \()[^)]+' # list operands to wire up or delete

Prevention

When it happens

Trigger: Defining an operand (e.g. for a planned instruction) but never using it in any match rule/encode; deleting the instructions that used an operand while leaving the definition.

Common situations: Ports and experiments on cpu .ad files; upstream refactors that dropped instructions but kept operands; expected noise when a platform intentionally keeps spare operands.

Related errors


AI-assisted analysis of openjdk/jdk@88dfb74bbe (2026-08-14). Data as JSON: /api/errors/0ad6332761f6e22a. Report an issue: GitHub.