[PATCH] D60057: [llvm-exegesis] Handle CMOV's OPERAND_COND_CODE OperandType

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 1 05:39:00 PDT 2019


lebedev.ri added inline comments.


================
Comment at: tools/llvm-exegesis/lib/SnippetGenerator.cpp:49
               : RATC.emptyRegisters();
       // TODO: Generate as many BenchmarkCode as needed.
       {
----------------
courbet wrote:
> lebedev.ri wrote:
> > Any advice on how to best produce multiple variants covering all the condcodes?
> > The obvious solution could be to pass `BenchmarkCode` to Target hook that would
> > duplicate it for each of the possible condcodes,
> > and return vector that would get appended to `Output`.
> > Is that on the right track? Anything cleaner?
> I think the original idea was to generate several identical templates and let randomization handle exploration. With what you just implemented when generating several instances of the same template you always get the same cond code because you wrote:
> 
> ```
>  AssignedValue = llvm::MCOperand::createImm(1);
> ```
> 
> if you did something like:
> 
> ```
>  AssignedValue = llvm::MCOperand::createImm(random_int_in_range(0, 2));
> ```
> 
> Then half of your generated snippets would go each way.
> 
> + @gchatelet who started[[ https://github.com/llvm-mirror/llvm/commit/b1497a74adb1d3669dbb16a9e02ee5214ea211a6 |  implementing support for exploration  ]].
Hmm, yes, that is the least intrusive solution, but that is waay too brittle. :(
Is that really the recommended solution here, given that we know all the affected opcodes and the possible condcodes?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D60057





More information about the llvm-commits mailing list