[all-commits] [llvm/llvm-project] 15a24e: [GlobalISel] Combine mulo x, 2 -> addo x, x

Jessica Paquette via All-commits all-commits at lists.llvm.org
Tue Sep 28 17:00:07 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 15a24e1fdbc446bc3d0fa0bf6c2a1aa44281cc75
      https://github.com/llvm/llvm-project/commit/15a24e1fdbc446bc3d0fa0bf6c2a1aa44281cc75
  Author: Jessica Paquette <jpaquette at apple.com>
  Date:   2021-09-28 (Tue, 28 Sep 2021)

  Changed paths:
    M llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
    M llvm/include/llvm/Target/GlobalISel/Combine.td
    M llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
    A llvm/test/CodeGen/AArch64/GlobalISel/combine-mulo-with-2.mir

  Log Message:
  -----------
  [GlobalISel] Combine mulo x, 2 -> addo x, x

Similar to what SDAG does when it sees a smulo/umulo against 2
(see: `DAGCombiner::visitMULO`)

This pattern is fairly common in Swift code AFAICT.

Here's an example extracted from a Swift testcase:

https://godbolt.org/z/6cT8Mesx7

Differential Revision: https://reviews.llvm.org/D110662




More information about the All-commits mailing list