[PATCH] D109729: [RISCV] Optimize (add (shl x, c0), (shl y, c1))

Ben Shi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 13 21:44:00 PDT 2021


benshi001 added a comment.

In D109729#2998986 <https://reviews.llvm.org/D109729#2998986>, @craig.topper wrote:

> In D109729#2998980 <https://reviews.llvm.org/D109729#2998980>, @benshi001 wrote:
>
>> Using `let PredicateCodeUsesOperands = 1` makes code more boring and complex. So I have resorted to using DAG2GAG selection which looks more clear.
>
> I'm not sure what you mean by boring here. Can you share one of the PatFrags using that feature?

Using `let PredicateCodeUsesOperands = 1` also needs implementing `let GISelPredicateCode = [{...}]`, otherwise the TableGen will failed.

such as

  def patfrags_test_pat : PatFrags<
    (ops node:$x, node:$y, node:$z),
    [ (xor (add node:$x, node:$y), node:$z),
      (xor (sub node:$x, node:$y), node:$z)
    ], [{ return foo(); }]> {
    let GISelPredicateCode = [{
      return doesComplexCheck(MI);
    }];
  
    let PredicateCodeUsesOperands = 1;
  }

That make the code becomes more redundant and complex.


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

https://reviews.llvm.org/D109729



More information about the llvm-commits mailing list