[llvm] [llvm-exegesis] [AArch64] Resolving "not all operands are initialized by snippet generator" (PR #142529)

David Green via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 26 02:02:49 PDT 2025


================
@@ -276,6 +276,12 @@ static Error randomizeMCOperand(const LLVMState &State,
     AssignedValue = MCOperand::createReg(randomBit(AllowedRegs));
     break;
   }
+  /// Omit unknown and pc-relative operands to imm value based on the
+  /// instruction
+  case MCOI::OperandType::OPERAND_UNKNOWN:
----------------
davemgreen wrote:

I get that it enabled more instructions but it feels too sloppy. Some instructions with immediates accept 0, but many do not (as you have found with movimsl).

For the ones that do accept 0, that is often an uninteresting value. A add of 0 does nothing and could have completely different scheduling characteristics than one with a sensible immediate. A shift or 0 is often quicker than an instruction with a higher shift. There is a reason that OPERAND_IMMEDIATE choses to use a value of 1. The same goes for OPERAND_PCREL where 0 might not be an interesting value for an adr, where something like 8 might be better.

Plus OPERAND_UNKNOWN doesn't mean OPERAND_IMMEDIATE. Some operands are not actually immediates. If you wanted to replace operands with OPERAND_IMMEDIATE where we know 1 is a valid value, that would be OK. (Immediates with known ranges are better though).

I would remove OPERAND_UNKNOWN from this patch. It could be added in a follow-up but I would still be against it.

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


More information about the llvm-commits mailing list