[PATCH] D87668: [GISel] Add new GISel combiners for G_MUL

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 15 09:10:30 PDT 2020


paquette added a comment.

In the future, can you do a full-context diff? It lets reviewers see the full file.

e.g.

`git show -U999999`



================
Comment at: llvm/include/llvm/Target/GlobalISel/Combine.td:441
+// Transform (mul x, 1) -> x
+def mul_by_one: GICombineRule <
+  (defs root:$root),
----------------
This could probably be a `right_identity_one` combine, similar to `right_identity_zero`. Then you can add any other operators where this is true to the `wip_match_opcode` list in a follow-up.


================
Comment at: llvm/include/llvm/Target/GlobalISel/Combine.td:453
+  (match (wip_match_opcode G_MUL):$root,
+         [{ return Helper.matchCombineMulByNegativeOne(*${root}, ${matchinfo}); }]),
+  (apply [{ return Helper.applyCombineMulByNegativeOne(*${root}, ${matchinfo}); }])
----------------
Could this use `matchConstantOp`?


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

https://reviews.llvm.org/D87668



More information about the llvm-commits mailing list