[all-commits] [llvm/llvm-project] 47d078: [GlobalISel] Handle more types in narrowScalar for...

Jessica Paquette via All-commits all-commits at lists.llvm.org
Mon Jul 12 22:19:19 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 47d0780f454d3f7c42bdba13c0682bf2a0095bca
      https://github.com/llvm/llvm-project/commit/47d0780f454d3f7c42bdba13c0682bf2a0095bca
  Author: Jessica Paquette <jpaquette at apple.com>
  Date:   2021-07-12 (Mon, 12 Jul 2021)

  Changed paths:
    M llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
    M llvm/test/CodeGen/AArch64/GlobalISel/legalize-cmp.mir

  Log Message:
  -----------
  [GlobalISel] Handle more types in narrowScalar for eq/ne G_ICMP

Generalize the existing eq/ne case using `extractParts`. The original code only
handled narrowings for types of width 2n->n. This generalization allows for any
type that can be broken down by `extractParts`.

General overview is:

- Loop over each narrow-sized part and do exactly what the 2-register case did.
- Loop over the leftover-sized parts and do the same thing
- Widen the leftover-sized XOR results to the desired narrow size
- OR that all together and then do the comparison against 0 (just like the old
  code)

This shows up a lot when building clang for AArch64 using GlobalISel, so it's
worth fixing. For the sake of simplicity, this doesn't handle the non-eq/ne
case yet.

Also remove the code in this case that notifies the observer; we're just going
to delete MI anyway so talking to the observer shouldn't be necessary.

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




More information about the All-commits mailing list