[all-commits] [llvm/llvm-project] 47aeef: [GlobalISel] Use GCDTy when extracting GCD ty from...

Jessica Paquette via All-commits all-commits at lists.llvm.org
Fri Jul 9 14:16:12 PDT 2021


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

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

  Log Message:
  -----------
  [GlobalISel] Use GCDTy when extracting GCD ty from leftover regs in insertParts

`LegalizerHelper::insertParts` uses `extractGCDType` on registers split into
a desired type and a smaller leftover type. This is used to populate a list
of registers. Each register in the list will have the same type as returned by
`extractGCDType`.

If we have

- `ResultTy` = s792
- `PartTy` = s64
- `LeftoverTy` = s24

When we call `extractGCDType`, we'll end up with two different types appended
to the list:

Part: gcd(792, 64, 24) => s8
Leftover: gcd(792, 24, 24) => s24

When this happens, we'll hit an assert while trying to build a G_MERGE_VALUES.

This patch changes the code for the leftover type so that we reuse the GCD from
the desired type.

e.g.

Leftover: gcd(792, 8, 24) => s8

https://llvm.godbolt.org/z/137Kqxj6j

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




More information about the All-commits mailing list