[PATCH] D85050: [GlobalISel] Combine (logic_op (op x...), (op y...)) -> (op (logic_op x, y))

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 31 15:04:51 PDT 2020


paquette created this revision.
paquette added reviewers: arsenm, dsanders, aemerson.
Herald added subscribers: steven.zhang, hiraditya, rovka.
Herald added a project: LLVM.
paquette requested review of this revision.
Herald added a subscriber: wdng.

This implements

  (logic_op (op x...), (op y...)) -> (op (logic_op x, y))

when `op` is an extend, a shift, or an and.

This is similar to `DAGCombiner::hoistLogicOpWithSameOpcodeHands` (with a bunch of missing cases, e.g. G_TRUNC, G_BITCAST, etc.)

This is implemented so it works both pre and post-legalization.

I'm not entirely happy with the idea of creating (but not inserting) instructions in the match step, but it seems cleaner than passing around a bunch of registers etc. No strong opinions either way.


https://reviews.llvm.org/D85050

Files:
  llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
  llvm/include/llvm/Target/GlobalISel/Combine.td
  llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
  llvm/lib/Target/AArch64/AArch64Combine.td
  llvm/test/CodeGen/AArch64/GlobalISel/postlegalizercombiner-hoist-same-hands.mir
  llvm/test/CodeGen/AArch64/GlobalISel/prelegalizercombiner-hoist-same-hands.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85050.282323.patch
Type: text/x-patch
Size: 31213 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200731/26d5cb68/attachment.bin>


More information about the llvm-commits mailing list