[PATCH] D140907: [GlobalISel] New combine to commute constant operands to the RHS

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 3 09:30:09 PST 2023


arsenm accepted this revision.
arsenm added inline comments.
This revision is now accepted and ready to land.
Herald added a subscriber: wdng.


================
Comment at: llvm/include/llvm/Target/GlobalISel/Combine.td:348
+  (defs root:$root),
+  (match (wip_match_opcode G_ADD, G_MUL, G_AND, G_OR, G_XOR):$root, [{
+    return getIConstantVRegVal(${root}->getOperand(1).getReg(), MRI).has_value();
----------------
Should also get compares, but that's trickier since you have to swap the predicate


================
Comment at: llvm/include/llvm/Target/GlobalISel/Combine.td:360
+>;
+
 // Fold x op 0 -> x
----------------
Should also get the FP cases


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140907



More information about the llvm-commits mailing list